diff options
author | Determinant <[email protected]> | 2020-09-19 01:22:25 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2020-09-19 01:22:25 -0400 |
commit | 573ff7bbf2a0b529fd3f8acf4aa825e446c73423 (patch) | |
tree | f02eef21d4017d326c91fbc6a6b994374fd4b64d /plugin/evm/service.go | |
parent | d0bbfb33f16a69ce24e123b01ebb30de8193ddc8 (diff) |
WIP: fix bugs in crosschain transfer and support general assets
Diffstat (limited to 'plugin/evm/service.go')
-rw-r--r-- | plugin/evm/service.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/plugin/evm/service.go b/plugin/evm/service.go index a3325b7..9f2e61a 100644 --- a/plugin/evm/service.go +++ b/plugin/evm/service.go @@ -15,6 +15,7 @@ import ( "github.com/ava-labs/coreth" "github.com/ava-labs/avalanchego/api" + "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/utils/constants" "github.com/ava-labs/avalanchego/utils/crypto" "github.com/ava-labs/avalanchego/utils/formatting" @@ -267,7 +268,9 @@ func (service *AvaxAPI) ImportAVAX(_ *http.Request, args *ImportAVAXArgs, respon type ExportAVAXArgs struct { api.UserPass - // Amount of AVAX to send + // AssetID of the tokens + AssetID ids.ID `json:"assetID"` + // Amount of asset to send Amount json.Uint64 `json:"amount"` // ID of the address that will receive the AVAX. This address includes the @@ -302,8 +305,13 @@ func (service *AvaxAPI) ExportAVAX(_ *http.Request, args *ExportAVAXArgs, respon return fmt.Errorf("couldn't get addresses controlled by the user: %w", err) } + assetID := service.vm.ctx.AVAXAssetID + if !args.AssetID.IsZero() { + assetID = args.AssetID + } // Create the transaction tx, err := service.vm.newExportTx( + assetID, // AssetID uint64(args.Amount), // Amount chainID, // ID of the chain to send the funds to to, // Address |