@armory-sh/client-ethers 0.2.21-alpha.3.21 → 0.2.21-alpha.3.23

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.
package/dist/index.d.ts CHANGED
@@ -103,7 +103,7 @@ interface TransferWithAuthorizationParams {
103
103
  value: bigint | number;
104
104
  validAfter: bigint | number;
105
105
  validBefore: bigint | number;
106
- nonce: bigint | number;
106
+ nonce: `0x${string}`;
107
107
  }
108
108
  interface EIP712Domain {
109
109
  name: string;
@@ -138,7 +138,7 @@ declare function signPayment(signer: Signer, from: `0x${string}`, to: `0x${strin
138
138
  v: number;
139
139
  r: string;
140
140
  s: string;
141
- nonce: bigint;
141
+ nonce: `0x${string}`;
142
142
  }>;
143
143
  declare function recoverEIP3009Signer(params: TransferWithAuthorizationParams, signature: {
144
144
  v: number;
package/dist/index.js CHANGED
@@ -57,7 +57,7 @@ var EIP712_TYPES_ETHERS = {
57
57
  { name: "value", type: "uint256" },
58
58
  { name: "validAfter", type: "uint256" },
59
59
  { name: "validBefore", type: "uint256" },
60
- { name: "nonce", type: "uint256" }
60
+ { name: "nonce", type: "bytes32" }
61
61
  ]
62
62
  };
63
63
  async function signEIP3009(signer, params, domain) {
@@ -68,7 +68,7 @@ async function signEIP3009(signer, params, domain) {
68
68
  value: BigInt(params.value),
69
69
  validAfter: BigInt(params.validAfter),
70
70
  validBefore: BigInt(params.validBefore),
71
- nonce: BigInt(params.nonce)
71
+ nonce: params.nonce
72
72
  };
73
73
  const signature = await signer.signTypedData(domain, EIP712_TYPES_ETHERS, message);
74
74
  const { v, r, s } = ethers.Signature.from(signature);
@@ -87,7 +87,7 @@ async function signEIP3009WithDomain(signer, params, chainId, verifyingContract,
87
87
  }
88
88
  async function signPayment(signer, from, to, value, chainId, verifyingContract, expirySeconds = 3600, domainName, domainVersion) {
89
89
  const now = Math.floor(Date.now() / 1e3);
90
- const nonce = BigInt(now * 1e3);
90
+ const nonce = `0x${(now * 1e3).toString(16).padStart(64, "0")}`;
91
91
  const signature = await signEIP3009WithDomain(
92
92
  signer,
93
93
  { from, to, value, validAfter: 0n, validBefore: BigInt(now + expirySeconds), nonce },
@@ -105,7 +105,7 @@ async function recoverEIP3009Signer(params, signature, domain) {
105
105
  value: BigInt(params.value),
106
106
  validAfter: BigInt(params.validAfter),
107
107
  validBefore: BigInt(params.validBefore),
108
- nonce: BigInt(params.nonce)
108
+ nonce: params.nonce
109
109
  };
110
110
  const sig = ethers.Signature.from({
111
111
  v: signature.v,
@@ -178,7 +178,7 @@ async function createX402V2Payment(signer, requirements, fromAddress, nonce, val
178
178
  const authorization = {
179
179
  from: fromAddress,
180
180
  to: requirements.payTo,
181
- value: toAtomicUnits(requirements.maxAmountRequired),
181
+ value: toAtomicUnits(requirements.amount),
182
182
  validAfter: "0",
183
183
  validBefore: validBefore.toString(),
184
184
  nonce
@@ -189,7 +189,7 @@ async function createX402V2Payment(signer, requirements, fromAddress, nonce, val
189
189
  value: BigInt(authorization.value),
190
190
  validAfter: BigInt(authorization.validAfter),
191
191
  validBefore: BigInt(authorization.validBefore),
192
- nonce: BigInt(authorization.nonce)
192
+ nonce: authorization.nonce
193
193
  };
194
194
  const signature = await signEIP3009(signer, authParams, customDomain);
195
195
  const combinedSignature = `0x${signature.r.slice(2)}${signature.s.slice(2)}${signature.v.toString(16).padStart(2, "0")}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@armory-sh/client-ethers",
3
- "version": "0.2.21-alpha.3.21",
3
+ "version": "0.2.21-alpha.3.23",
4
4
  "license": "MIT",
5
5
  "author": "Sawyer Cutler <sawyer@dirtroad.dev>",
6
6
  "type": "module",
@@ -27,7 +27,7 @@
27
27
  "directory": "packages/client-ethers"
28
28
  },
29
29
  "dependencies": {
30
- "@armory-sh/base": "0.2.22-alpha.3.21",
30
+ "@armory-sh/base": "0.2.22-alpha.3.23",
31
31
  "ethers": "6.16.0"
32
32
  },
33
33
  "devDependencies": {