Created
March 19, 2022 05:19
-
-
Save johnthethird/a1063b65274bb162b77959632cbe5b54 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// FYI this will currently allow you to only import to the same addr you exported from | |
func (w *Wallet) buildExportTxC2P(srcAddr common.Address, amount uint64, amountPlusFee uint64, nonce uint64) (*evm.UnsignedExportTx, error) { | |
exportTx := &evm.UnsignedExportTx{ | |
NetworkID: w.ChainConfig.NetworkID, | |
BlockchainID: w.ChainConfig.CChainID, | |
DestinationChain: ids.Empty, | |
Ins: []evm.EVMInput{ | |
{ | |
Address: srcAddr, | |
Amount: amountPlusFee, | |
AssetID: w.ChainConfig.AVAXAssetID, | |
Nonce: nonce, | |
}, | |
}, | |
ExportedOutputs: []*avax.TransferableOutput{ | |
{ | |
Asset: avax.Asset{ID: w.ChainConfig.AVAXAssetID}, | |
Out: &secp256k1fx.TransferOutput{ | |
Amt: amount, | |
OutputOwners: secp256k1fx.OutputOwners{ | |
Threshold: uint32(1), | |
Addrs: []ids.ShortID{w.PublicKeyAvm().Address()}, | |
}, | |
}, | |
}, | |
}, | |
} | |
err := exportTx.ExportedOutputs[0].Out.Verify() | |
return exportTx, err | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Github you suck. Who TF would indent code like that? Can I talk to the manager?