-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support withdraw to chains with Ethereum accounts (#65)
* pangoro initial configuration * Support withdraw to chains with Ethereum accounts * Updated param name * Updated tests and snapshots * Review --------- Co-authored-by: Mario J Maurello <[email protected]>
- Loading branch information
Showing
12 changed files
with
141 additions
and
27 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { AssetSymbol, ChainKey } from '../../../constants'; | ||
import { PolkadotXcmExtrinsicSuccessEvent } from '../../../extrinsic'; | ||
import { | ||
assets, | ||
balance, | ||
chains, | ||
extrinsic, | ||
withdraw, | ||
} from '../moonbase.common'; | ||
import { MoonbaseXcmConfig } from '../moonbase.interfaces'; | ||
|
||
const asset = assets[AssetSymbol.PARING]; | ||
const origin = chains[ChainKey.DarwiniaPangoro]; | ||
|
||
export const PARING: MoonbaseXcmConfig = { | ||
asset, | ||
origin, | ||
deposit: { | ||
[origin.key]: { | ||
source: origin, | ||
balance: balance.system(), | ||
extrinsic: extrinsic | ||
.polkadotXcm() | ||
.limitedReserveTransferAssets() | ||
.successEvent(PolkadotXcmExtrinsicSuccessEvent.Attempted) | ||
.V1V2() | ||
.X1(), | ||
}, | ||
}, | ||
withdraw: { | ||
[origin.key]: withdraw.xTokens({ | ||
balance: balance.system(), | ||
destination: origin, | ||
feePerWeight: 1_000_000_000, | ||
}), | ||
}, | ||
}; |
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
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,52 @@ | ||
import { createWithdrawBuilder } from './withdraw'; | ||
|
||
describe('withdraw', () => { | ||
const account = '0xeF46c7649270C912704fB09B75097f6E32208b85'; | ||
const withdraw = createWithdrawBuilder(); | ||
|
||
describe('xTokens', () => { | ||
const cfg = withdraw.xTokens({ | ||
balance: '<BALANCE>' as any, | ||
destination: { parachainId: 1000 } as any, | ||
destination: { parachainId: 100 } as any, | ||
feePerWeight: 8, | ||
}); | ||
|
||
it('should be correct withdraw config', () => { | ||
expect(cfg).toMatchSnapshot(); | ||
}); | ||
describe('substrate account', () => { | ||
const account = '5GWpSdqkkKGZmdKQ9nkSF7TmHp6JWt28BMGQNuG4MXtSvq3e'; | ||
|
||
it('should get params with parachain id', () => { | ||
expect(cfg.getParams(account)).toMatchSnapshot(); | ||
it('should get params with parachain id', () => { | ||
expect(cfg.getParams(account, false)).toMatchSnapshot(); | ||
}); | ||
|
||
it('should get params without parachain id', () => { | ||
const cfg2 = withdraw.xTokens({ | ||
balance: '<BALANCE>' as any, | ||
destination: {} as any, | ||
feePerWeight: 8, | ||
}); | ||
|
||
expect(cfg2.getParams(account, false)).toMatchSnapshot(); | ||
}); | ||
}); | ||
|
||
it('should get params without parachain id', () => { | ||
const cfg2 = withdraw.xTokens({ | ||
balance: '<BALANCE>' as any, | ||
destination: {} as any, | ||
feePerWeight: 8, | ||
describe('eth account', () => { | ||
const account = '0xeF46c7649270C912704fB09B75097f6E32208b85'; | ||
|
||
it('should get params with parachain id', () => { | ||
expect(cfg.getParams(account, true)).toMatchSnapshot(); | ||
}); | ||
|
||
expect(cfg2.getParams(account)).toMatchSnapshot(); | ||
it('should get params without parachain id', () => { | ||
const cfg2 = withdraw.xTokens({ | ||
balance: '<BALANCE>' as any, | ||
destination: {} as any, | ||
feePerWeight: 8, | ||
}); | ||
|
||
expect(cfg2.getParams(account, true)).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); | ||
}); |
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
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