Skip to content

Commit

Permalink
Merge pull request #29 from CityOfZion/CU-86a24vkc6
Browse files Browse the repository at this point in the history
CU-86a24vkc6 - Update InitOptions to support validBlocks param
  • Loading branch information
luc10921 authored Feb 2, 2024
2 parents b3c0f15 + fd35c18 commit 5dddb13
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@cityofzion/neon-dappkit",
"comment": "Update InitOptions to support validBlocks param",
"type": "minor"
}
],
"packageName": "@cityofzion/neon-dappkit"
}
Empty file modified common/git-hooks/pre-push
100644 → 100755
Empty file.
5 changes: 3 additions & 2 deletions packages/neon-dappkit/src/NeonInvoker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export type ExtendedArg = Arg | { type: 'Address'; value: string } | { type: 'Sc
export type InitOptions = {
rpcAddress: string
account?: NeonTypes.wallet.Account | NeonTypes.wallet.Account[]
validBlocks?: number
signingCallback?: api.SigningFunction
}

Expand Down Expand Up @@ -89,9 +90,9 @@ export class NeonInvoker implements Neo3Invoker {
return result.map((item): RpcResponseStackItem => ({ value: item.value as any, type: item.type as any }))
}

static async init(options: InitOptions): Promise<NeonInvoker> {
static async init({ validBlocks = 100, ...options }: InitOptions): Promise<NeonInvoker> {
const networkMagic = await this.getMagicOfRpcAddress(options.rpcAddress)
return new NeonInvoker({ ...options, validBlocks: 100, networkMagic })
return new NeonInvoker({ ...options, validBlocks, networkMagic })
}

static async getMagicOfRpcAddress(rpcAddress: string): Promise<number> {
Expand Down

0 comments on commit 5dddb13

Please sign in to comment.