-
Notifications
You must be signed in to change notification settings - Fork 539
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 * Moved events definitions to correct files * Final touch
- Loading branch information
1 parent
83b85af
commit 0dfe360
Showing
50 changed files
with
2,724 additions
and
985 deletions.
There are no files selected for viewing
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
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,21 @@ | ||
import { SDK, WaitFor, Keyring, BondExtra, 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 bondExtra = { FreeBalance: amount } as BondExtra | ||
|
||
const result = await sdk.tx.nominationPools.bondExtra(bondExtra, WaitFor.BlockInclusion, account) | ||
if (result.isErr) { | ||
console.log(result.reason) | ||
process.exit(1) | ||
} | ||
|
||
console.log(JSON.stringify(result, null, 2)) | ||
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,20 @@ | ||
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 poolId = 1 | ||
|
||
const result = await sdk.tx.nominationPools.chill(poolId, WaitFor.BlockInclusion, account) | ||
if (result.isErr) { | ||
console.log(result.reason) | ||
process.exit(1) | ||
} | ||
|
||
console.log(JSON.stringify(result, null, 2)) | ||
process.exit() | ||
} | ||
main() |
20 changes: 20 additions & 0 deletions
20
avail-js/docs/extrinsics/nomination_pools_claim_commission.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,20 @@ | ||
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 poolId = 1 | ||
|
||
const result = await sdk.tx.nominationPools.claimCommission(poolId, WaitFor.BlockInclusion, account) | ||
if (result.isErr) { | ||
console.log(result.reason) | ||
process.exit(1) | ||
} | ||
|
||
console.log(JSON.stringify(result, null, 2)) | ||
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,19 @@ | ||
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 result = await sdk.tx.nominationPools.claimPayout(WaitFor.BlockInclusion, account) | ||
if (result.isErr) { | ||
console.log(result.reason) | ||
process.exit(1) | ||
} | ||
|
||
console.log(JSON.stringify(result, null, 2)) | ||
process.exit() | ||
} | ||
main() |
20 changes: 20 additions & 0 deletions
20
avail-js/docs/extrinsics/nomination_pools_claim_payout_other.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,20 @@ | ||
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 other = "5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty" // Bob | ||
|
||
const result = await sdk.tx.nominationPools.claimPayoutOther(other, WaitFor.BlockInclusion, account) | ||
if (result.isErr) { | ||
console.log(result.reason) | ||
process.exit(1) | ||
} | ||
|
||
console.log(JSON.stringify(result, null, 2)) | ||
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
20 changes: 20 additions & 0 deletions
20
avail-js/docs/extrinsics/nomination_pools_set_claim_permission.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,20 @@ | ||
import { SDK, WaitFor, Keyring, ClaimPermission } 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 permission: ClaimPermission = "PermissionlessAll" | ||
|
||
const result = await sdk.tx.nominationPools.setClaimPermission(permission, WaitFor.BlockInclusion, account) | ||
if (result.isErr) { | ||
console.log(result.reason) | ||
process.exit(1) | ||
} | ||
|
||
console.log(JSON.stringify(result, null, 2)) | ||
process.exit() | ||
} | ||
main() |
21 changes: 21 additions & 0 deletions
21
avail-js/docs/extrinsics/nomination_pools_set_commission.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,21 @@ | ||
import { SDK, WaitFor, Keyring, NewCommission } 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 poolId = 1 | ||
const newCommission: NewCommission = { amount: 25, payee: "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" } | ||
|
||
const result = await sdk.tx.nominationPools.setCommission(poolId, newCommission, WaitFor.BlockInclusion, account) | ||
if (result.isErr) { | ||
console.log(result.reason) | ||
process.exit(1) | ||
} | ||
|
||
console.log(JSON.stringify(result, null, 2)) | ||
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 } 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 poolId = 1 | ||
const metadata = "My Metadata" | ||
|
||
const result = await sdk.tx.nominationPools.setMetadata(poolId, metadata, WaitFor.BlockInclusion, account) | ||
if (result.isErr) { | ||
console.log(result.reason) | ||
process.exit(1) | ||
} | ||
|
||
console.log(JSON.stringify(result, null, 2)) | ||
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, PoolState } 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 poolId = 2 | ||
const state: PoolState = "Blocked" | ||
|
||
const result = await sdk.tx.nominationPools.setState(poolId, state, WaitFor.BlockInclusion, account) | ||
if (result.isErr) { | ||
console.log(result.reason) | ||
process.exit(1) | ||
} | ||
|
||
console.log(JSON.stringify(result, null, 2)) | ||
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("//Alice") | ||
const memberAccount = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" // Alice | ||
const unbondingPoints = new BN(10).pow(new BN(18)).mul(new BN(100)) // 100 Avail | ||
|
||
const result = await sdk.tx.nominationPools.unbond(memberAccount, unbondingPoints, WaitFor.BlockInclusion, account) | ||
if (result.isErr) { | ||
console.log(result.reason) | ||
process.exit(1) | ||
} | ||
|
||
console.log(JSON.stringify(result, null, 2)) | ||
process.exit() | ||
} | ||
main() |
26 changes: 26 additions & 0 deletions
26
avail-js/docs/extrinsics/nomination_pools_withdraw_unbonded.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,26 @@ | ||
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 memberAccount = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" // Alice | ||
const numSlashingSpans = 0 | ||
|
||
const result = await sdk.tx.nominationPools.withdrawUnbonded( | ||
memberAccount, | ||
numSlashingSpans, | ||
WaitFor.BlockInclusion, | ||
account, | ||
) | ||
if (result.isErr) { | ||
console.log(result.reason) | ||
process.exit(1) | ||
} | ||
|
||
console.log(JSON.stringify(result, null, 2)) | ||
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
Oops, something went wrong.