Skip to content

Commit

Permalink
Xcm (#9)
Browse files Browse the repository at this point in the history
* remove test button in balance

Signed-off-by: Ruben <rubdeivis@gmail.com>

* add moonbeam config

Signed-off-by: Ruben <rubdeivis@gmail.com>

* add moonriver xcm config

Signed-off-by: Ruben <rubdeivis@gmail.com>

* default assets for moonbeam and moonriver

Signed-off-by: Ruben <rubdeivis@gmail.com>

* map xcm selectable assets on send

Signed-off-by: Ruben <rubdeivis@gmail.com>

---------

Signed-off-by: Ruben <rubdeivis@gmail.com>
  • Loading branch information
rubenguc authored May 9, 2023
1 parent 80d22d3 commit 8c06d01
Show file tree
Hide file tree
Showing 12 changed files with 621 additions and 133 deletions.
312 changes: 312 additions & 0 deletions src/abi/xtokens_moonbeam_abi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,312 @@
[
{
"inputs": [
{
"internalType": "address",
"name": "currencyAddress",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"components": [
{
"internalType": "uint8",
"name": "parents",
"type": "uint8"
},
{
"internalType": "bytes[]",
"name": "interior",
"type": "bytes[]"
}
],
"internalType": "struct Xtokens.Multilocation",
"name": "destination",
"type": "tuple"
},
{
"internalType": "uint64",
"name": "weight",
"type": "uint64"
}
],
"name": "transfer",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"components": [
{
"internalType": "uint8",
"name": "parents",
"type": "uint8"
},
{
"internalType": "bytes[]",
"name": "interior",
"type": "bytes[]"
}
],
"internalType": "struct Xtokens.Multilocation",
"name": "location",
"type": "tuple"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"internalType": "struct Xtokens.MultiAsset[]",
"name": "assets",
"type": "tuple[]"
},
{
"internalType": "uint32",
"name": "feeItem",
"type": "uint32"
},
{
"components": [
{
"internalType": "uint8",
"name": "parents",
"type": "uint8"
},
{
"internalType": "bytes[]",
"name": "interior",
"type": "bytes[]"
}
],
"internalType": "struct Xtokens.Multilocation",
"name": "destination",
"type": "tuple"
},
{
"internalType": "uint64",
"name": "weight",
"type": "uint64"
}
],
"name": "transferMultiAssets",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "address",
"name": "currencyAddress",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"internalType": "struct Xtokens.Currency[]",
"name": "currencies",
"type": "tuple[]"
},
{
"internalType": "uint32",
"name": "feeItem",
"type": "uint32"
},
{
"components": [
{
"internalType": "uint8",
"name": "parents",
"type": "uint8"
},
{
"internalType": "bytes[]",
"name": "interior",
"type": "bytes[]"
}
],
"internalType": "struct Xtokens.Multilocation",
"name": "destination",
"type": "tuple"
},
{
"internalType": "uint64",
"name": "weight",
"type": "uint64"
}
],
"name": "transferMultiCurrencies",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "uint8",
"name": "parents",
"type": "uint8"
},
{
"internalType": "bytes[]",
"name": "interior",
"type": "bytes[]"
}
],
"internalType": "struct Xtokens.Multilocation",
"name": "asset",
"type": "tuple"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"components": [
{
"internalType": "uint8",
"name": "parents",
"type": "uint8"
},
{
"internalType": "bytes[]",
"name": "interior",
"type": "bytes[]"
}
],
"internalType": "struct Xtokens.Multilocation",
"name": "destination",
"type": "tuple"
},
{
"internalType": "uint64",
"name": "weight",
"type": "uint64"
}
],
"name": "transferMultiasset",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "uint8",
"name": "parents",
"type": "uint8"
},
{
"internalType": "bytes[]",
"name": "interior",
"type": "bytes[]"
}
],
"internalType": "struct Xtokens.Multilocation",
"name": "asset",
"type": "tuple"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "fee",
"type": "uint256"
},
{
"components": [
{
"internalType": "uint8",
"name": "parents",
"type": "uint8"
},
{
"internalType": "bytes[]",
"name": "interior",
"type": "bytes[]"
}
],
"internalType": "struct Xtokens.Multilocation",
"name": "destination",
"type": "tuple"
},
{
"internalType": "uint64",
"name": "weight",
"type": "uint64"
}
],
"name": "transferMultiassetWithFee",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "currencyAddress",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "fee",
"type": "uint256"
},
{
"components": [
{
"internalType": "uint8",
"name": "parents",
"type": "uint8"
},
{
"internalType": "bytes[]",
"name": "interior",
"type": "bytes[]"
}
],
"internalType": "struct Xtokens.Multilocation",
"name": "destination",
"type": "tuple"
},
{
"internalType": "uint64",
"name": "weight",
"type": "uint64"
}
],
"name": "transferWithFee",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
29 changes: 29 additions & 0 deletions src/constants/assets.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,37 @@
import { BN } from "bn.js";
import { BigNumber } from "ethers";
import { PARACHAINS } from "./chains";

export const REF_TIME = new BN("1000000000000");
export const PROOF_SIZE = new BN("1000000000000");

export const BigNumber0 = BigNumber.from(0);
export const BN0 = new BN("0");

export const defaultAssetConfig = {
[PARACHAINS.MOONBEAM]: [
{
address: "0xFfFFfFff1FcaCBd218EDc0EbA20Fc2308C778080",
symbol: "xcDOT",
decimals: 10,
},
{
address: "0xFfFFFfffA893AD19e540E172C10d78D4d479B5Cf",
symbol: "xcASTR",
decimals: 18,
},
],

[PARACHAINS.MOONRIVER]: [
{
address: "0xFfFFfFff1FcaCBd218EDc0EbA20Fc2308C778080",
symbol: "xcKSM",
decimals: 12,
},
{
address: "0xFFFfffFF0Ca324C842330521525E7De111F38972",
symbol: "xcSDN",
decimals: 18,
},
],
};
Loading

0 comments on commit 8c06d01

Please sign in to comment.