@armory-sh/base 0.2.22-alpha.3.22 → 0.2.22-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/eip712.d.ts +3 -3
- package/dist/index.js +4 -3
- package/package.json +1 -1
package/dist/eip712.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export interface TransferWithAuthorization {
|
|
|
17
17
|
value: bigint;
|
|
18
18
|
validAfter: bigint;
|
|
19
19
|
validBefore: bigint;
|
|
20
|
-
nonce:
|
|
20
|
+
nonce: `0x${string}`;
|
|
21
21
|
}
|
|
22
22
|
export type TransferWithAuthorizationRecord = TransferWithAuthorization & Record<string, unknown>;
|
|
23
23
|
export type TypedDataField = {
|
|
@@ -45,7 +45,7 @@ export declare const EIP712_TYPES: {
|
|
|
45
45
|
readonly type: "uint256";
|
|
46
46
|
}, {
|
|
47
47
|
readonly name: "nonce";
|
|
48
|
-
readonly type: "
|
|
48
|
+
readonly type: "bytes32";
|
|
49
49
|
}];
|
|
50
50
|
};
|
|
51
51
|
export declare const USDC_DOMAIN: {
|
|
@@ -57,6 +57,6 @@ export declare const createTransferWithAuthorization: (params: Omit<TransferWith
|
|
|
57
57
|
value: bigint | number;
|
|
58
58
|
validAfter: bigint | number;
|
|
59
59
|
validBefore: bigint | number;
|
|
60
|
-
nonce:
|
|
60
|
+
nonce: `0x${string}`;
|
|
61
61
|
}) => TransferWithAuthorizationRecord;
|
|
62
62
|
export declare const validateTransferWithAuthorization: (message: TransferWithAuthorization) => boolean;
|
package/dist/index.js
CHANGED
|
@@ -566,7 +566,7 @@ var EIP712_TYPES = {
|
|
|
566
566
|
{ name: "value", type: "uint256" },
|
|
567
567
|
{ name: "validAfter", type: "uint256" },
|
|
568
568
|
{ name: "validBefore", type: "uint256" },
|
|
569
|
-
{ name: "nonce", type: "
|
|
569
|
+
{ name: "nonce", type: "bytes32" }
|
|
570
570
|
]
|
|
571
571
|
};
|
|
572
572
|
var USDC_DOMAIN = {
|
|
@@ -585,9 +585,10 @@ var createTransferWithAuthorization = (params) => ({
|
|
|
585
585
|
value: BigInt(params.value),
|
|
586
586
|
validAfter: BigInt(params.validAfter),
|
|
587
587
|
validBefore: BigInt(params.validBefore),
|
|
588
|
-
nonce:
|
|
588
|
+
nonce: params.nonce
|
|
589
589
|
});
|
|
590
590
|
var isAddress2 = (value) => /^0x[a-fA-F0-9]{40}$/.test(value);
|
|
591
|
+
var isBytes32 = (value) => /^0x[a-fA-F0-9]{64}$/.test(value);
|
|
591
592
|
var validateTransferWithAuthorization = (message) => {
|
|
592
593
|
if (!isAddress2(message.from)) throw new Error(`Invalid "from" address: ${message.from}`);
|
|
593
594
|
if (!isAddress2(message.to)) throw new Error(`Invalid "to" address: ${message.to}`);
|
|
@@ -597,7 +598,7 @@ var validateTransferWithAuthorization = (message) => {
|
|
|
597
598
|
if (message.validAfter >= message.validBefore) {
|
|
598
599
|
throw new Error(`"validAfter" (${message.validAfter}) must be before "validBefore" (${message.validBefore})`);
|
|
599
600
|
}
|
|
600
|
-
if (message.nonce
|
|
601
|
+
if (!isBytes32(message.nonce)) throw new Error(`"nonce" must be a valid bytes32 hex string: ${message.nonce}`);
|
|
601
602
|
return true;
|
|
602
603
|
};
|
|
603
604
|
|