Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ jobs:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
submodules: recursive
- name: setup node
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: 18.x
node-version: 24.x
cache: 'yarn'

- run: yarn --immutable
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ jobs:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
submodules: recursive
- name: setup node
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: 18.x
node-version: 24.x
cache: 'yarn'
- run: yarn --immutable
- run: yarn lint
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
submodules: recursive
- name: setup node
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: 18.x
node-version: 24.x
cache: 'yarn'
- run: yarn --immutable
- run: yarn update-env
- run: yarn test -u
- name: Commit and Create PR
uses: actions/github-script@v6
uses: actions/github-script@v8
with:
script: |
const branchName = `update-snapshots-${context.sha.slice(0, 7)}`
Expand Down
1 change: 1 addition & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default tseslint.config(
'@typescript-eslint/require-await': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
Expand Down
312 changes: 0 additions & 312 deletions helpers/api/extrinsics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,140 +6,6 @@ export const balance = async (api: ApiPromise, address: string) => {
return account.data.toJSON()
}

export const xTokensForRelayChain = (api: ApiPromise, amount: string, address: Uint8Array) => {
return api.tx.xTokens.transfer(
{
Token: 'KSM',
},
amount,
{
V1: {
parents: 1,
interior: {
X1: {
AccountId32: {
network: 'Any',
id: address,
},
},
},
},
},
'Unlimited',
)
}

export const xTokensForParaChain = (
api: ApiPromise,
token: object,
parachainId: string,
amount: string,
address: Uint8Array,
) => {
return api.tx.xTokens.transfer(
token,
amount,
{
V1: {
parents: 1,
interior: {
X2: [
{
Parachain: parachainId,
},
{
AccountId32: {
network: 'Any',
id: address,
},
},
],
},
},
},
'Unlimited',
)
}

export const xTokens = (
api: ApiPromise,
isRelayChain: boolean,
parachainId: string,
token: object,
amount: string | bigint,
address: Uint8Array,
) => {
const multiLocation = isRelayChain
? { X1: { AccountId32: { network: 'Any', id: address } } }
: {
X2: [
{
Parachain: parachainId,
},
{
AccountId32: {
network: 'Any',
id: address,
},
},
],
}

return api.tx.xTokens.transfer(
token,
amount,
{
V1: {
parents: 1,
interior: multiLocation,
},
},
'Unlimited',
)
}

export const xTokensV3 = (
api: ApiPromise,
isRelayChain: boolean,
parachainId: string,
token: object,
amount: string | bigint,
address: Uint8Array,
) => {
const multiLocation = isRelayChain
? {
X1: {
AccountId32: {
id: address,
},
},
}
: {
X2: [
{
Parachain: parachainId,
},
{
AccountId32: {
id: address,
},
},
],
}

return api.tx.xTokens.transfer(
token,
amount,
{
V3: {
parents: 1,
interior: multiLocation,
},
} as any,
'Unlimited',
)
}

export const relayChainV3limitedReserveTransferAssets = (
api: ApiPromise,
parachainId: string,
Expand Down Expand Up @@ -179,181 +45,3 @@ export const relayChainV3limitedReserveTransferAssets = (
'Unlimited',
)
}

export const xTokensTransferMulticurrencies = (
api: ApiPromise,
foreignAssetId: string,
amount: string,
parachainId: string,
address: Uint8Array,
) => {
return api.tx.xTokens.transferMulticurrencies(
[
[
{
ForeignAsset: foreignAssetId,
},
amount,
],
[
{
Token: 'KSM',
},
'16000000000',
],
],
'1',
{
V1: {
parents: 1,
interior: {
X2: [
{
Parachain: parachainId,
},
{
AccountId32: {
network: 'Any',
id: address,
},
},
],
},
},
},
'Unlimited',
)
}

export const xTokensTransferTransferMultiasset = (
api: ApiPromise,
interior: any[],
amount: string,
parachainId: string,
address: Uint8Array,
) => {
return api.tx.xTokens.transferMultiasset(
{
V1: {
fun: {
Fungible: amount,
},
id: {
Concrete: {
parents: 1,
interior: {
X3: interior,
},
},
},
},
},
{
V1: {
parents: 1,
interior: {
X2: [
{
Parachain: parachainId,
},
{
AccountId32: {
network: 'Any',
id: address,
},
},
],
},
},
},
'Unlimited',
)
}

export const xTokensTransferTransferMultiassetV3 = (
api: ApiPromise,
interior: any[],
amount: string,
parachainId: string,
address: Uint8Array,
) => {
return api.tx.xTokens.transferMultiasset(
{
V3: {
fun: {
Fungible: amount,
},
id: {
Concrete: {
parents: 1,
interior: {
X3: interior,
},
},
},
},
},
{
V3: {
parents: 1,
interior: {
X2: [
{
Parachain: parachainId,
},
{
AccountId32: {
id: address,
},
},
],
},
},
} as any,
'Unlimited',
)
}

export const xTokensTransferMulticurrenciesV3 = (
api: ApiPromise,
foreignAssetId: string,
amount: string,
parachainId: string,
address: Uint8Array,
) => {
return api.tx.xTokens.transferMulticurrencies(
[
[
{
ForeignAsset: foreignAssetId,
},
amount,
],
[
{
Token: 'KSM',
},
'16000000000',
],
],
'1',
{
V3: {
parents: 1,
interior: {
X2: [
{
Parachain: parachainId,
},
{
AccountId32: {
id: address,
},
},
],
},
},
} as any,
'Unlimited',
)
}
Loading
Loading