Skip to content

Commit

Permalink
Pass Declare Nonce to Starknet CLI (#324)
Browse files Browse the repository at this point in the history
* [skip ci]
  • Loading branch information
solimander committed Feb 24, 2023
1 parent e5e0a9f commit a34fb4a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ export abstract class Account {

const signature = this.getSignatures(messageHash);
return contractFactory.declare({
nonce,
signature,
token: options.token,
sender: this.address,
Expand Down
5 changes: 5 additions & 0 deletions src/starknet-wrappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ interface DeclareWrapperOptions {
signature?: string[];
token?: string;
sender?: string;
nonce?: string;
}

interface InteractWrapperOptions {
Expand Down Expand Up @@ -162,6 +163,10 @@ export abstract class StarknetWrapper {
}
prepared.push("--max_fee", options.maxFee);

if (options.nonce) {
prepared.push("--nonce", options.nonce);
}

return prepared;
}

Expand Down
3 changes: 2 additions & 1 deletion src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,8 @@ export class StarknetContractFactory {
maxFee: (options.maxFee || 0).toString(),
token: options.token,
signature: handleSignature(options.signature),
sender: options.sender
sender: options.sender,
nonce: options.nonce?.toString()
});
if (executed.statusCode) {
const msg = `Could not declare class: ${executed.stderr.toString()}`;
Expand Down

0 comments on commit a34fb4a

Please sign in to comment.