@aztec/entrypoints 1.0.0-nightly.20250604 → 1.0.0-nightly.20250606

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,9 +21,9 @@ import { EncodedCallsForEntrypoint, computeCombinedPayloadHash } from './encodin
21
21
  // Initial request with calls, authWitnesses and capsules
22
22
  const { calls, authWitnesses, capsules, extraHashedArgs } = exec;
23
23
  // Global tx options
24
- const { cancellable, nonce } = options;
24
+ const { cancellable, txNonce } = options;
25
25
  // Encode the calls for the app
26
- const appEncodedCalls = await EncodedCallsForEntrypoint.fromAppExecution(calls, nonce);
26
+ const appEncodedCalls = await EncodedCallsForEntrypoint.fromAppExecution(calls, txNonce);
27
27
  // Get the execution payload for the fee, it includes the calls and potentially authWitnesses
28
28
  const { calls: feeCalls, authWitnesses: feeAuthwitnesses } = await fee.paymentMethod.getExecutionPayload(fee.gasSettings);
29
29
  // Encode the calls for the fee
@@ -139,7 +139,7 @@ import { EncodedCallsForEntrypoint, computeCombinedPayloadHash } from './encodin
139
139
  }
140
140
  },
141
141
  {
142
- name: 'nonce',
142
+ name: 'tx_nonce',
143
143
  type: {
144
144
  kind: 'field'
145
145
  }
@@ -218,7 +218,7 @@ import { EncodedCallsForEntrypoint, computeCombinedPayloadHash } from './encodin
218
218
  }
219
219
  },
220
220
  {
221
- name: 'nonce',
221
+ name: 'tx_nonce',
222
222
  type: {
223
223
  kind: 'field'
224
224
  }
@@ -21,7 +21,7 @@ import { EncodedCallsForEntrypoint } from './encoding.js';
21
21
  this.version = version;
22
22
  }
23
23
  async createTxExecutionRequest(exec, fee, options) {
24
- if (options.nonce || options.cancellable !== undefined) {
24
+ if (options.txNonce || options.cancellable !== undefined) {
25
25
  throw new Error('TxExecutionOptions are not supported in DappEntrypoint');
26
26
  }
27
27
  // Initial request with calls, authWitnesses and capsules
@@ -146,7 +146,7 @@ import { EncodedCallsForEntrypoint } from './encoding.js';
146
146
  }
147
147
  },
148
148
  {
149
- name: 'nonce',
149
+ name: 'tx_nonce',
150
150
  type: {
151
151
  kind: 'field'
152
152
  }
@@ -10,7 +10,7 @@ import { HashedValues, TxContext, TxExecutionRequest } from '@aztec/stdlib/tx';
10
10
  this.rollupVersion = rollupVersion;
11
11
  }
12
12
  async createTxExecutionRequest(exec, fee, options) {
13
- if (options.nonce || options.cancellable !== undefined) {
13
+ if (options.txNonce || options.cancellable !== undefined) {
14
14
  throw new Error('TxExecutionOptions are not supported in DefaultEntrypoint');
15
15
  }
16
16
  // Initial request with calls, authWitnesses and capsules
@@ -126,7 +126,7 @@ import { EncodedCallsForEntrypoint } from './encoding.js';
126
126
  }
127
127
  },
128
128
  {
129
- name: 'nonce',
129
+ name: 'tx_nonce',
130
130
  type: {
131
131
  kind: 'field'
132
132
  }
@@ -37,8 +37,12 @@ export declare abstract class EncodedCallsForEntrypoint implements EncodedCalls
37
37
  hashedArguments: HashedValues[];
38
38
  /** The index of the generator to use for hashing */
39
39
  generatorIndex: number;
40
- /** The nonce for the payload, used to emit a nullifier identifying the call */
41
- nonce: Fr;
40
+ /**
41
+ * A nonce to inject into the payload of the transaction. When used with cancellable=true, this nonce will be
42
+ * used to compute a nullifier that allows cancelling this transaction by submitting a new one with the same nonce
43
+ * but higher fee. The nullifier ensures only one transaction can succeed.
44
+ */
45
+ tx_nonce: Fr;
42
46
  constructor(
43
47
  /** Function calls in the expected format (Noir's convention) */
44
48
  encodedFunctionCalls: EncodedFunctionCall[],
@@ -46,8 +50,12 @@ export declare abstract class EncodedCallsForEntrypoint implements EncodedCalls
46
50
  hashedArguments: HashedValues[],
47
51
  /** The index of the generator to use for hashing */
48
52
  generatorIndex: number,
49
- /** The nonce for the payload, used to emit a nullifier identifying the call */
50
- nonce: Fr);
53
+ /**
54
+ * A nonce to inject into the payload of the transaction. When used with cancellable=true, this nonce will be
55
+ * used to compute a nullifier that allows cancelling this transaction by submitting a new one with the same nonce
56
+ * but higher fee. The nullifier ensures only one transaction can succeed.
57
+ */
58
+ tx_nonce: Fr);
51
59
  /**
52
60
  * The function calls to execute. This uses snake_case naming so that it is compatible with Noir encoding
53
61
  * @internal
@@ -74,10 +82,11 @@ export declare abstract class EncodedCallsForEntrypoint implements EncodedCalls
74
82
  /**
75
83
  * Encodes the functions for the app-portion of a transaction from a set of function calls and a nonce
76
84
  * @param functionCalls - The function calls to execute
77
- * @param nonce - The nonce for the payload, used to emit a nullifier identifying the call
85
+ * @param txNonce - A nonce used to enable transaction cancellation when cancellable=true. Transactions with the same
86
+ * nonce can be replaced by submitting a new one with a higher fee.
78
87
  * @returns The encoded calls
79
88
  */
80
- static fromAppExecution(functionCalls: FunctionCall[] | Tuple<FunctionCall, typeof APP_MAX_CALLS>, nonce?: Fr): Promise<EncodedAppEntrypointCalls>;
89
+ static fromAppExecution(functionCalls: FunctionCall[] | Tuple<FunctionCall, typeof APP_MAX_CALLS>, txNonce?: Fr): Promise<EncodedAppEntrypointCalls>;
81
90
  /**
82
91
  * Creates an encoded set of functions to pay the fee for a transaction
83
92
  * @param functionCalls - The calls generated by the payment method
@@ -88,13 +97,13 @@ export declare abstract class EncodedCallsForEntrypoint implements EncodedCalls
88
97
  }
89
98
  /** Encoded calls for app phase execution. */
90
99
  export declare class EncodedAppEntrypointCalls extends EncodedCallsForEntrypoint {
91
- constructor(encodedFunctionCalls: EncodedFunctionCall[], hashedArguments: HashedValues[], generatorIndex: number, nonce: Fr);
100
+ constructor(encodedFunctionCalls: EncodedFunctionCall[], hashedArguments: HashedValues[], generatorIndex: number, txNonce: Fr);
92
101
  toFields(): Fr[];
93
102
  }
94
103
  /** Encoded calls for fee payment */
95
104
  export declare class EncodedFeeEntrypointCalls extends EncodedCallsForEntrypoint {
96
105
  #private;
97
- constructor(encodedFunctionCalls: EncodedFunctionCall[], hashedArguments: HashedValues[], generatorIndex: number, nonce: Fr, isFeePayer: boolean);
106
+ constructor(encodedFunctionCalls: EncodedFunctionCall[], hashedArguments: HashedValues[], generatorIndex: number, txNonce: Fr, isFeePayer: boolean);
98
107
  toFields(): Fr[];
99
108
  /** Whether the sender should be appointed as fee payer. */
100
109
  get is_fee_payer(): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"encoding.d.ts","sourceRoot":"","sources":["../src/encoding.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAgB,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAIhD,QAAA,MAAM,aAAa,IAAI,CAAC;AAExB,QAAA,MAAM,aAAa,IAAI,CAAC;AAExB,oDAAoD;AACpD,MAAM,MAAM,mBAAmB,GAAG;IAChC,mCAAmC;IACnC,oGAAoG;IACpG,SAAS,EAAE,EAAE,CAAC;IACd,uCAAuC;IACvC,iBAAiB,EAAE,EAAE,CAAC;IACtB,sCAAsC;IACtC,cAAc,EAAE,EAAE,CAAC;IACnB,gDAAgD;IAChD,SAAS,EAAE,OAAO,CAAC;IACnB,2CAA2C;IAC3C,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,sFAAsF;AACtF,MAAM,MAAM,YAAY,GAAG;IACzB,gEAAgE;IAChE,oBAAoB,EAAE,mBAAmB,EAAE,CAAC;IAC5C,gFAAgF;IAChF,eAAe,EAAE,YAAY,EAAE,CAAC;CACjC,CAAC;AAEF;;;;KAIK;AACL,8BAAsB,yBAA0B,YAAW,YAAY;IAEnE,gEAAgE;IACzD,oBAAoB,EAAE,mBAAmB,EAAE;IAClD,gFAAgF;IACzE,eAAe,EAAE,YAAY,EAAE;IACtC,oDAAoD;IAC7C,cAAc,EAAE,MAAM;IAC7B,+EAA+E;IACxE,KAAK,EAAE,EAAE;;IAPhB,gEAAgE;IACzD,oBAAoB,EAAE,mBAAmB,EAAE;IAClD,gFAAgF;IACzE,eAAe,EAAE,YAAY,E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C,YAAY,CAAC,CAuBzE"}
package/dest/encoding.js CHANGED
@@ -17,12 +17,17 @@ const FEE_MAX_CALLS = 2;
17
17
  encodedFunctionCalls;
18
18
  hashedArguments;
19
19
  generatorIndex;
20
- nonce;
21
- constructor(/** Function calls in the expected format (Noir's convention) */ encodedFunctionCalls, /** The hashed args for the call, ready to be injected in the execution cache */ hashedArguments, /** The index of the generator to use for hashing */ generatorIndex, /** The nonce for the payload, used to emit a nullifier identifying the call */ nonce){
20
+ tx_nonce;
21
+ constructor(/** Function calls in the expected format (Noir's convention) */ encodedFunctionCalls, /** The hashed args for the call, ready to be injected in the execution cache */ hashedArguments, /** The index of the generator to use for hashing */ generatorIndex, /**
22
+ * A nonce to inject into the payload of the transaction. When used with cancellable=true, this nonce will be
23
+ * used to compute a nullifier that allows cancelling this transaction by submitting a new one with the same nonce
24
+ * but higher fee. The nullifier ensures only one transaction can succeed.
25
+ */ // eslint-disable-next-line camelcase
26
+ tx_nonce){
22
27
  this.encodedFunctionCalls = encodedFunctionCalls;
23
28
  this.hashedArguments = hashedArguments;
24
29
  this.generatorIndex = generatorIndex;
25
- this.nonce = nonce;
30
+ this.tx_nonce = tx_nonce;
26
31
  }
27
32
  /* eslint-disable camelcase */ /**
28
33
  * The function calls to execute. This uses snake_case naming so that it is compatible with Noir encoding
@@ -56,15 +61,16 @@ const FEE_MAX_CALLS = 2;
56
61
  /**
57
62
  * Encodes the functions for the app-portion of a transaction from a set of function calls and a nonce
58
63
  * @param functionCalls - The function calls to execute
59
- * @param nonce - The nonce for the payload, used to emit a nullifier identifying the call
64
+ * @param txNonce - A nonce used to enable transaction cancellation when cancellable=true. Transactions with the same
65
+ * nonce can be replaced by submitting a new one with a higher fee.
60
66
  * @returns The encoded calls
61
- */ static async fromAppExecution(functionCalls, nonce = Fr.random()) {
67
+ */ static async fromAppExecution(functionCalls, txNonce = Fr.random()) {
62
68
  if (functionCalls.length > APP_MAX_CALLS) {
63
69
  throw new Error(`Expected at most ${APP_MAX_CALLS} function calls, got ${functionCalls.length}`);
64
70
  }
65
71
  const paddedCalls = padArrayEnd(functionCalls, FunctionCall.empty(), APP_MAX_CALLS);
66
72
  const encoded = await encode(paddedCalls);
67
- return new EncodedAppEntrypointCalls(encoded.encodedFunctionCalls, encoded.hashedArguments, GeneratorIndex.SIGNATURE_PAYLOAD, nonce);
73
+ return new EncodedAppEntrypointCalls(encoded.encodedFunctionCalls, encoded.hashedArguments, GeneratorIndex.SIGNATURE_PAYLOAD, txNonce);
68
74
  }
69
75
  /**
70
76
  * Creates an encoded set of functions to pay the fee for a transaction
@@ -78,26 +84,26 @@ const FEE_MAX_CALLS = 2;
78
84
  }
79
85
  }
80
86
  /** Encoded calls for app phase execution. */ export class EncodedAppEntrypointCalls extends EncodedCallsForEntrypoint {
81
- constructor(encodedFunctionCalls, hashedArguments, generatorIndex, nonce){
82
- super(encodedFunctionCalls, hashedArguments, generatorIndex, nonce);
87
+ constructor(encodedFunctionCalls, hashedArguments, generatorIndex, txNonce){
88
+ super(encodedFunctionCalls, hashedArguments, generatorIndex, txNonce);
83
89
  }
84
90
  toFields() {
85
91
  return [
86
92
  ...this.functionCallsToFields(),
87
- this.nonce
93
+ this.tx_nonce
88
94
  ];
89
95
  }
90
96
  }
91
97
  /** Encoded calls for fee payment */ export class EncodedFeeEntrypointCalls extends EncodedCallsForEntrypoint {
92
98
  #isFeePayer;
93
- constructor(encodedFunctionCalls, hashedArguments, generatorIndex, nonce, isFeePayer){
94
- super(encodedFunctionCalls, hashedArguments, generatorIndex, nonce);
99
+ constructor(encodedFunctionCalls, hashedArguments, generatorIndex, txNonce, isFeePayer){
100
+ super(encodedFunctionCalls, hashedArguments, generatorIndex, txNonce);
95
101
  this.#isFeePayer = isFeePayer;
96
102
  }
97
103
  toFields() {
98
104
  return [
99
105
  ...this.functionCallsToFields(),
100
- this.nonce,
106
+ this.tx_nonce,
101
107
  new Fr(this.#isFeePayer)
102
108
  ];
103
109
  }
@@ -11,8 +11,12 @@ import type { ExecutionPayload } from './payload.js';
11
11
  export type TxExecutionOptions = {
12
12
  /** Whether the transaction can be cancelled. */
13
13
  cancellable?: boolean;
14
- /** The nonce to use for the transaction. */
15
- nonce?: Fr;
14
+ /**
15
+ * A nonce to inject into the app payload of the transaction. When used with cancellable=true, this nonce will be
16
+ * used to compute a nullifier that allows cancelling this transaction by submitting a new one with the same nonce
17
+ * but higher fee. The nullifier ensures only one transaction can succeed.
18
+ */
19
+ txNonce?: Fr;
16
20
  };
17
21
  /**
18
22
  * Creates transaction execution requests out of a set of function calls, a fee payment method and
@@ -23,7 +27,7 @@ export interface EntrypointInterface {
23
27
  * Generates an execution request out of set of function calls.
24
28
  * @param exec - The execution intents to be run.
25
29
  * @param fee - The fee options for the transaction.
26
- * @param options - Nonce and whether the transaction is cancellable.
30
+ * @param options - Transaction nonce and whether the transaction is cancellable.
27
31
  * @returns The authenticated transaction execution request.
28
32
  */
29
33
  createTxExecutionRequest(exec: ExecutionPayload, fee: FeeOptions, options: TxExecutionOptions): Promise<TxExecutionRequest>;
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,gDAAgD;IAChD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,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AM,MAAM,UAAU,GAAG;IACvB,oCAAoC;IACpC,aAAa,EAAE,gBAAgB,CAAC;IAChC,uBAAuB;IACvB,WAAW,EAAE,WAAW,CAAC;CAC1B,CAAC;AAGF,oCAAoC;AACpC,MAAM,MAAM,cAAc,GAAG;IAC3B,oCAAoC;IACpC,aAAa,CAAC,EAAE,gBAAgB,CAAC;IACjC,uBAAuB;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;IAC7C,mEAAmE;IACnE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,4GAA4G;IAC5G,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,qHAAqH;IACrH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@aztec/entrypoints",
3
3
  "homepage": "https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/entrypoints",
4
4
  "description": "Implementation of sample contract entrypoints for the Aztec Network",
5
- "version": "1.0.0-nightly.20250604",
5
+ "version": "1.0.0-nightly.20250606",
6
6
  "type": "module",
7
7
  "exports": {
8
8
  "./dapp": "./dest/dapp_entrypoint.js",
@@ -64,10 +64,10 @@
64
64
  ]
65
65
  },
66
66
  "dependencies": {
67
- "@aztec/constants": "1.0.0-nightly.20250604",
68
- "@aztec/foundation": "1.0.0-nightly.20250604",
69
- "@aztec/protocol-contracts": "1.0.0-nightly.20250604",
70
- "@aztec/stdlib": "1.0.0-nightly.20250604",
67
+ "@aztec/constants": "1.0.0-nightly.20250606",
68
+ "@aztec/foundation": "1.0.0-nightly.20250606",
69
+ "@aztec/protocol-contracts": "1.0.0-nightly.20250606",
70
+ "@aztec/stdlib": "1.0.0-nightly.20250606",
71
71
  "tslib": "^2.4.0"
72
72
  },
73
73
  "devDependencies": {
@@ -28,9 +28,9 @@ export class DefaultAccountEntrypoint implements EntrypointInterface {
28
28
  // Initial request with calls, authWitnesses and capsules
29
29
  const { calls, authWitnesses, capsules, extraHashedArgs } = exec;
30
30
  // Global tx options
31
- const { cancellable, nonce } = options;
31
+ const { cancellable, txNonce } = options;
32
32
  // Encode the calls for the app
33
- const appEncodedCalls = await EncodedCallsForEntrypoint.fromAppExecution(calls, nonce);
33
+ const appEncodedCalls = await EncodedCallsForEntrypoint.fromAppExecution(calls, txNonce);
34
34
  // Get the execution payload for the fee, it includes the calls and potentially authWitnesses
35
35
  const { calls: feeCalls, authWitnesses: feeAuthwitnesses } = await fee.paymentMethod.getExecutionPayload(
36
36
  fee.gasSettings,
@@ -117,7 +117,7 @@ export class DefaultAccountEntrypoint implements EntrypointInterface {
117
117
  },
118
118
  },
119
119
  },
120
- { name: 'nonce', type: { kind: 'field' } },
120
+ { name: 'tx_nonce', type: { kind: 'field' } },
121
121
  ],
122
122
  },
123
123
  visibility: 'public',
@@ -160,7 +160,7 @@ export class DefaultAccountEntrypoint implements EntrypointInterface {
160
160
  },
161
161
  },
162
162
  },
163
- { name: 'nonce', type: { kind: 'field' } },
163
+ { name: 'tx_nonce', type: { kind: 'field' } },
164
164
  { name: 'is_fee_payer', type: { kind: 'boolean' } },
165
165
  ],
166
166
  },
@@ -27,7 +27,7 @@ export class DefaultDappEntrypoint implements EntrypointInterface {
27
27
  fee: FeeOptions,
28
28
  options: TxExecutionOptions,
29
29
  ): Promise<TxExecutionRequest> {
30
- if (options.nonce || options.cancellable !== undefined) {
30
+ if (options.txNonce || options.cancellable !== undefined) {
31
31
  throw new Error('TxExecutionOptions are not supported in DappEntrypoint');
32
32
  }
33
33
  // Initial request with calls, authWitnesses and capsules
@@ -122,7 +122,7 @@ export class DefaultDappEntrypoint implements EntrypointInterface {
122
122
  },
123
123
  },
124
124
  },
125
- { name: 'nonce', type: { kind: 'field' } },
125
+ { name: 'tx_nonce', type: { kind: 'field' } },
126
126
  ],
127
127
  },
128
128
  visibility: 'public',
@@ -18,7 +18,7 @@ export class DefaultEntrypoint implements EntrypointInterface {
18
18
  fee: FeeOptions,
19
19
  options: TxExecutionOptions,
20
20
  ): Promise<TxExecutionRequest> {
21
- if (options.nonce || options.cancellable !== undefined) {
21
+ if (options.txNonce || options.cancellable !== undefined) {
22
22
  throw new Error('TxExecutionOptions are not supported in DefaultEntrypoint');
23
23
  }
24
24
  // Initial request with calls, authWitnesses and capsules
@@ -98,7 +98,7 @@ export class DefaultMultiCallEntrypoint implements EntrypointInterface {
98
98
  },
99
99
  },
100
100
  },
101
- { name: 'nonce', type: { kind: 'field' } },
101
+ { name: 'tx_nonce', type: { kind: 'field' } },
102
102
  ],
103
103
  },
104
104
  visibility: 'public',
package/src/encoding.ts CHANGED
@@ -48,8 +48,13 @@ export abstract class EncodedCallsForEntrypoint implements EncodedCalls {
48
48
  public hashedArguments: HashedValues[],
49
49
  /** The index of the generator to use for hashing */
50
50
  public generatorIndex: number,
51
- /** The nonce for the payload, used to emit a nullifier identifying the call */
52
- public nonce: Fr,
51
+ /**
52
+ * A nonce to inject into the payload of the transaction. When used with cancellable=true, this nonce will be
53
+ * used to compute a nullifier that allows cancelling this transaction by submitting a new one with the same nonce
54
+ * but higher fee. The nullifier ensures only one transaction can succeed.
55
+ */
56
+ // eslint-disable-next-line camelcase
57
+ public tx_nonce: Fr,
53
58
  ) {}
54
59
 
55
60
  /* eslint-disable camelcase */
@@ -100,12 +105,13 @@ export abstract class EncodedCallsForEntrypoint implements EncodedCalls {
100
105
  /**
101
106
  * Encodes the functions for the app-portion of a transaction from a set of function calls and a nonce
102
107
  * @param functionCalls - The function calls to execute
103
- * @param nonce - The nonce for the payload, used to emit a nullifier identifying the call
108
+ * @param txNonce - A nonce used to enable transaction cancellation when cancellable=true. Transactions with the same
109
+ * nonce can be replaced by submitting a new one with a higher fee.
104
110
  * @returns The encoded calls
105
111
  */
106
112
  static async fromAppExecution(
107
113
  functionCalls: FunctionCall[] | Tuple<FunctionCall, typeof APP_MAX_CALLS>,
108
- nonce = Fr.random(),
114
+ txNonce = Fr.random(),
109
115
  ) {
110
116
  if (functionCalls.length > APP_MAX_CALLS) {
111
117
  throw new Error(`Expected at most ${APP_MAX_CALLS} function calls, got ${functionCalls.length}`);
@@ -116,7 +122,7 @@ export abstract class EncodedCallsForEntrypoint implements EncodedCalls {
116
122
  encoded.encodedFunctionCalls,
117
123
  encoded.hashedArguments,
118
124
  GeneratorIndex.SIGNATURE_PAYLOAD,
119
- nonce,
125
+ txNonce,
120
126
  );
121
127
  }
122
128
 
@@ -148,13 +154,13 @@ export class EncodedAppEntrypointCalls extends EncodedCallsForEntrypoint {
148
154
  encodedFunctionCalls: EncodedFunctionCall[],
149
155
  hashedArguments: HashedValues[],
150
156
  generatorIndex: number,
151
- nonce: Fr,
157
+ txNonce: Fr,
152
158
  ) {
153
- super(encodedFunctionCalls, hashedArguments, generatorIndex, nonce);
159
+ super(encodedFunctionCalls, hashedArguments, generatorIndex, txNonce);
154
160
  }
155
161
 
156
162
  override toFields(): Fr[] {
157
- return [...this.functionCallsToFields(), this.nonce];
163
+ return [...this.functionCallsToFields(), this.tx_nonce];
158
164
  }
159
165
  }
160
166
 
@@ -166,15 +172,15 @@ export class EncodedFeeEntrypointCalls extends EncodedCallsForEntrypoint {
166
172
  encodedFunctionCalls: EncodedFunctionCall[],
167
173
  hashedArguments: HashedValues[],
168
174
  generatorIndex: number,
169
- nonce: Fr,
175
+ txNonce: Fr,
170
176
  isFeePayer: boolean,
171
177
  ) {
172
- super(encodedFunctionCalls, hashedArguments, generatorIndex, nonce);
178
+ super(encodedFunctionCalls, hashedArguments, generatorIndex, txNonce);
173
179
  this.#isFeePayer = isFeePayer;
174
180
  }
175
181
 
176
182
  override toFields(): Fr[] {
177
- return [...this.functionCallsToFields(), this.nonce, new Fr(this.#isFeePayer)];
183
+ return [...this.functionCallsToFields(), this.tx_nonce, new Fr(this.#isFeePayer)];
178
184
  }
179
185
 
180
186
  /* eslint-disable camelcase */
package/src/interfaces.ts CHANGED
@@ -13,8 +13,12 @@ import type { ExecutionPayload } from './payload.js';
13
13
  export type TxExecutionOptions = {
14
14
  /** Whether the transaction can be cancelled. */
15
15
  cancellable?: boolean;
16
- /** The nonce to use for the transaction. */
17
- nonce?: Fr;
16
+ /**
17
+ * A nonce to inject into the app payload of the transaction. When used with cancellable=true, this nonce will be
18
+ * used to compute a nullifier that allows cancelling this transaction by submitting a new one with the same nonce
19
+ * but higher fee. The nullifier ensures only one transaction can succeed.
20
+ */
21
+ txNonce?: Fr;
18
22
  };
19
23
 
20
24
  /**
@@ -26,7 +30,7 @@ export interface EntrypointInterface {
26
30
  * Generates an execution request out of set of function calls.
27
31
  * @param exec - The execution intents to be run.
28
32
  * @param fee - The fee options for the transaction.
29
- * @param options - Nonce and whether the transaction is cancellable.
33
+ * @param options - Transaction nonce and whether the transaction is cancellable.
30
34
  * @returns The authenticated transaction execution request.
31
35
  */
32
36
  createTxExecutionRequest(