-
Notifications
You must be signed in to change notification settings - Fork 535
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated avail js with new interfaces (#660)
* Updated avail js with new interfaces * change path and update package version --------- Co-authored-by: Leouarz <[email protected]>
- Loading branch information
1 parent
326107b
commit f25f0e5
Showing
40 changed files
with
2,255 additions
and
1,864 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
20 changes: 6 additions & 14 deletions
20
avail-js/docs/extrinsics/da_set_submit_data_fee_modifier.ts
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { SDK, WaitFor, Keyring, BN } from "avail-js-sdk" | ||
|
||
const main = async () => { | ||
const providerEndpoint = "ws://127.0.0.1:9944" | ||
const sdk = await SDK.New(providerEndpoint) | ||
|
||
// Input | ||
const account = new Keyring({ type: "sr25519" }).addFromUri("//Alice") | ||
const amount = new BN(10).pow(new BN(18)).mul(new BN(10000)) // 10_000 Avail | ||
|
||
const root: string = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" // Alice | ||
const nominator: string = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" // Alice | ||
const bouncer: string = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" // Alice | ||
|
||
const result = await sdk.tx.nominationPools.create(amount, root, nominator, bouncer, WaitFor.BlockInclusion, account) | ||
if (result.isErr) { | ||
console.log(result.reason) | ||
process.exit(1) | ||
} | ||
|
||
console.log(JSON.stringify(result, null, 4)) | ||
process.exit() | ||
} | ||
main() |
33 changes: 33 additions & 0 deletions
33
avail-js/docs/extrinsics/nomination_pools_create_with_pool_id.ts
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,33 @@ | ||
import { SDK, WaitFor, Keyring, BN } from "avail-js-sdk" | ||
|
||
const main = async () => { | ||
const providerEndpoint = "ws://127.0.0.1:9944" | ||
const sdk = await SDK.New(providerEndpoint) | ||
|
||
// Input | ||
const account = new Keyring({ type: "sr25519" }).addFromUri("//Bob") | ||
const amount = new BN(10).pow(new BN(18)).mul(new BN(10000)) // 10_000 Avail | ||
|
||
const root: string = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" // Alice | ||
const nominator: string = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" // Alice | ||
const bouncer: string = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" // Alice | ||
const poolId = 0 | ||
|
||
const result = await sdk.tx.nominationPools.createWithPoolId( | ||
amount, | ||
root, | ||
nominator, | ||
bouncer, | ||
poolId, | ||
WaitFor.BlockInclusion, | ||
account, | ||
) | ||
if (result.isErr) { | ||
console.log(result.reason) | ||
process.exit(1) | ||
} | ||
|
||
console.log(JSON.stringify(result, null, 4)) | ||
process.exit() | ||
} | ||
main() |
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,21 @@ | ||
import { SDK, WaitFor, Keyring, BN } from "avail-js-sdk" | ||
|
||
const main = async () => { | ||
const providerEndpoint = "ws://127.0.0.1:9944" | ||
const sdk = await SDK.New(providerEndpoint) | ||
|
||
// Input | ||
const account = new Keyring({ type: "sr25519" }).addFromUri("//Bob") | ||
const amount = new BN(10).pow(new BN(18)).mul(new BN(10000)) // 10_000 Avail | ||
const poolId = 1 | ||
|
||
const result = await sdk.tx.nominationPools.join(amount, poolId, WaitFor.BlockInclusion, account) | ||
if (result.isErr) { | ||
console.log(result.reason) | ||
process.exit(1) | ||
} | ||
|
||
console.log(JSON.stringify(result, null, 4)) | ||
process.exit() | ||
} | ||
main() |
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,24 @@ | ||
import { SDK, WaitFor, Keyring } from "avail-js-sdk" | ||
|
||
const main = async () => { | ||
const providerEndpoint = "ws://127.0.0.1:9944" | ||
const sdk = await SDK.New(providerEndpoint) | ||
|
||
// Input | ||
const account = new Keyring({ type: "sr25519" }).addFromUri("//Alice") | ||
const validators: string[] = [ | ||
"5GNJqTPyNqANBkUVMN1LPPrxXnFouWXoe2wNSmmEoLctxiZY", | ||
"5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy", | ||
] | ||
const poolId = 1 | ||
|
||
const result = await sdk.tx.nominationPools.nominate(poolId, validators, WaitFor.BlockInclusion, account) | ||
if (result.isErr) { | ||
console.log(result.reason) | ||
process.exit(1) | ||
} | ||
|
||
console.log(JSON.stringify(result, null, 4)) | ||
process.exit() | ||
} | ||
main() |
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
Oops, something went wrong.