Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into fusion-mvp
Browse files Browse the repository at this point in the history
  • Loading branch information
Leouarz committed Oct 25, 2024
2 parents 8e724a2 + 2e467f8 commit 39717e9
Show file tree
Hide file tree
Showing 17 changed files with 287 additions and 285 deletions.
446 changes: 223 additions & 223 deletions avail-js/docs/extrinsics/README.md

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions avail-js/docs/extrinsics/da_submit_data.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SDK, WaitFor, Keyring } from "avail-js-sdk"
import { SDK, WaitFor, Keyring, TransactionOptions } from "avail-js-sdk"

const main = async () => {
const providerEndpoint = "ws://127.0.0.1:9944"
Expand All @@ -8,7 +8,8 @@ const main = async () => {
const account = new Keyring({ type: "sr25519" }).addFromUri("//Alice")
const data = "My Awesome Data"

const result = await sdk.tx.dataAvailability.submitData(data, WaitFor.BlockInclusion, account)
const options: TransactionOptions = { app_id: 1 }
const result = await sdk.tx.dataAvailability.submitData(data, WaitFor.BlockInclusion, account, options)
if (result.isErr) {
console.log(result.reason)
process.exit(1)
Expand Down
8 changes: 4 additions & 4 deletions avail-js/docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion avail-js/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.1",
"description": "Shows a basic usage of the Avail-js SDK",
"dependencies": {
"avail-js-sdk": "^0.2.18"
"avail-js-sdk": "^0.3.0"
},
"resolutions": {
"ws": ">=8.17.1"
Expand Down
8 changes: 4 additions & 4 deletions avail-js/examples/next-example/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion avail-js/examples/next-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@types/react": "18.2.67",
"@types/react-dom": "18.2.22",
"autoprefixer": "10.4.18",
"avail-js-sdk": "^0.2.18",
"avail-js-sdk": "^0.3.0",
"eslint": "8.57.0",
"eslint-config-next": "14.1.4",
"next": "^14.2.12",
Expand Down
8 changes: 4 additions & 4 deletions avail-js/examples/node-examples/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion avail-js/examples/node-examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"validium": "npm run build && node build/node-examples/src/validium.js"
},
"dependencies": {
"avail-js-sdk": "^0.2.18",
"avail-js-sdk": "^0.3.0",
"ethers": "^6.13.2"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions avail-js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion avail-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "avail-js-sdk",
"version": "0.2.18",
"version": "0.3.0",
"description": "Avail library of functions to interact with blockchain and manipulate transactions",
"main": "./build/index.js",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions avail-js/src/sdk/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export {
ClaimPermission,
NewCommission,
PoolState,
TransactionOptions,
} from "./transactions"

export class SDK {
Expand Down
9 changes: 4 additions & 5 deletions avail-js/src/sdk/transactions/balances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import { BN } from "@polkadot/util"
import { KeyringPair } from "@polkadot/keyring/types"
import { err, Result } from "neverthrow"

import { SignerOptions } from "@polkadot/api/types"
import { decodeError } from "../../helpers"
import { WaitFor, GenericFailure, standardCallback, getBlockHashAndTxHash } from "./common"
import { WaitFor, GenericFailure, standardCallback, getBlockHashAndTxHash, TransactionOptions } from "./common"

type TransferKeepAliveTxSuccess = {
isErr: false
Expand Down Expand Up @@ -51,7 +50,7 @@ export class Balances {
keepAlive: boolean,
waitFor: WaitFor,
account: KeyringPair,
options?: Partial<SignerOptions>,
options?: TransactionOptions,
): Promise<TransferAllTxSuccess | GenericFailure> {
const optionWrapper = options || {}
const maybeTxResult = await new Promise<Result<ISubmittableResult, string>>((res, _) => {
Expand Down Expand Up @@ -96,7 +95,7 @@ export class Balances {
value: BN,
waitFor: WaitFor,
account: KeyringPair,
options?: Partial<SignerOptions>,
options?: TransactionOptions,
): Promise<TransferAllowDeathTxSuccess | GenericFailure> {
const optionWrapper = options || {}
const maybeTxResult = await new Promise<Result<ISubmittableResult, string>>((res, _) => {
Expand Down Expand Up @@ -150,7 +149,7 @@ export class Balances {
value: BN,
waitFor: WaitFor,
account: KeyringPair,
options?: Partial<SignerOptions>,
options?: TransactionOptions,
): Promise<TransferKeepAliveTxSuccess | GenericFailure> {
const optionWrapper = options || {}
const maybeTxResult = await new Promise<Result<ISubmittableResult, string>>((res, _) => {
Expand Down
7 changes: 7 additions & 0 deletions avail-js/src/sdk/transactions/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,10 @@ export async function getBlockHashAndTxHash(
}

export type GenericFailure = { isErr: true; reason: string }

export interface TransactionOptions {
app_id?: number
nonce?: number
era?: number
blockHash?: H256
}
14 changes: 6 additions & 8 deletions avail-js/src/sdk/transactions/da.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ import { H256, EventRecord } from "@polkadot/types/interfaces/types"
import { BN } from "@polkadot/util"
import { KeyringPair } from "@polkadot/keyring/types"
import { err, Result } from "neverthrow"

import * as TransactionData from "./../transaction_data"
import { SignerOptions } from "@polkadot/api/types"
import { decodeError, fromHexToAscii } from "../../helpers"
import { WaitFor, GenericFailure, standardCallback, getBlockHashAndTxHash } from "./common"
import { WaitFor, GenericFailure, standardCallback, getBlockHashAndTxHash, TransactionOptions } from "./common"

export type DispatchFeeModifier = {
weightMaximumFee: BN | null
Expand Down Expand Up @@ -74,7 +72,7 @@ export class DataAvailability {
data: string,
waitFor: WaitFor,
account: KeyringPair,
options?: Partial<SignerOptions>,
options?: TransactionOptions,
): Promise<SubmitDataTxSuccess | GenericFailure> {
const optionWrapper = options || {}
const maybeTxResult = await new Promise<Result<ISubmittableResult, string>>((res, _) => {
Expand Down Expand Up @@ -131,7 +129,7 @@ export class DataAvailability {
key: string,
waitFor: WaitFor,
account: KeyringPair,
options?: Partial<SignerOptions>,
options?: TransactionOptions,
): Promise<CreateApplicationKeyTxSuccess | GenericFailure> {
const optionWrapper = options || {}
const maybeTxResult = await new Promise<Result<ISubmittableResult, string>>((res, _) => {
Expand Down Expand Up @@ -175,7 +173,7 @@ export class DataAvailability {
newKey: string,
waitFor: WaitFor,
account: KeyringPair,
options?: Partial<SignerOptions>,
options?: TransactionOptions,
): Promise<SetApplicationKeyTxSuccess | GenericFailure> {
const optionWrapper = options || {}
const maybeTxResult = await new Promise<Result<ISubmittableResult, string>>((res, _) => {
Expand Down Expand Up @@ -230,7 +228,7 @@ export class DataAvailability {
cols: number,
waitFor: WaitFor,
account: KeyringPair,
options?: Partial<SignerOptions>,
options?: TransactionOptions,
): Promise<SubmitBlockLengthProposalTxSuccess | GenericFailure> {
const optionWrapper = options || {}
const maybeTxResult = await new Promise<Result<ISubmittableResult, string>>((res, _) => {
Expand Down Expand Up @@ -292,7 +290,7 @@ export class DataAvailability {
modifier: DispatchFeeModifier,
waitFor: WaitFor,
account: KeyringPair,
options?: Partial<SignerOptions>,
options?: TransactionOptions,
): Promise<SetSubmitDataFeeModifierTxSuccess | GenericFailure> {
const optionWrapper = options || {}
const maybeTxResult = await new Promise<Result<ISubmittableResult, string>>((res, _) => {
Expand Down
2 changes: 1 addition & 1 deletion avail-js/src/sdk/transactions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Staking } from "./staking"
import { DataAvailability } from "./da"
import { NominationPools } from "./nomination_pools"

export { WaitFor } from "./common"
export { WaitFor, TransactionOptions } from "./common"
export { DispatchFeeModifier } from "./da"
export { StakingRewardDestination } from "./staking"
export { BondExtra, ClaimPermission, NewCommission, PoolState } from "./nomination_pools"
Expand Down
Loading

0 comments on commit 39717e9

Please sign in to comment.