@seapay-ai/erc3009 0.1.0 → 0.1.1
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/README.md +267 -48
- package/dist/api/index.d.ts +2 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/prepare.d.ts +47 -0
- package/dist/api/prepare.d.ts.map +1 -0
- package/dist/api/prepare.js +57 -0
- package/dist/core.d.ts +14 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +13 -0
- package/dist/domain/index.d.ts +3 -0
- package/dist/domain/index.d.ts.map +1 -0
- package/dist/domain/index.js +2 -0
- package/dist/domain/normalize.d.ts +9 -0
- package/dist/domain/normalize.d.ts.map +1 -0
- package/dist/domain/normalize.js +25 -0
- package/dist/domain/resolveDomain.d.ts +15 -0
- package/dist/domain/resolveDomain.d.ts.map +1 -0
- package/dist/domain/resolveDomain.js +47 -0
- package/dist/erc3009/buildTypes.d.ts +6 -0
- package/dist/erc3009/buildTypes.d.ts.map +1 -0
- package/dist/erc3009/buildTypes.js +11 -0
- package/dist/erc3009/constants.d.ts +7 -0
- package/dist/erc3009/constants.d.ts.map +1 -0
- package/dist/erc3009/constants.js +6 -0
- package/dist/erc3009/index.d.ts +7 -0
- package/dist/erc3009/index.d.ts.map +1 -0
- package/dist/erc3009/index.js +6 -0
- package/dist/erc3009/message.d.ts +21 -0
- package/dist/erc3009/message.d.ts.map +1 -0
- package/dist/erc3009/message.js +29 -0
- package/dist/erc3009/sign.d.ts +7 -0
- package/dist/erc3009/sign.d.ts.map +1 -0
- package/dist/erc3009/sign.js +8 -0
- package/dist/erc3009/typedData.d.ts +15 -0
- package/dist/erc3009/typedData.d.ts.map +1 -0
- package/dist/erc3009/typedData.js +21 -0
- package/dist/erc3009/verify.d.ts +10 -0
- package/dist/erc3009/verify.d.ts.map +1 -0
- package/dist/erc3009/verify.js +17 -0
- package/dist/index.d.ts +23 -34
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +35 -65
- package/dist/registry/chains.d.ts +22 -0
- package/dist/registry/chains.d.ts.map +1 -0
- package/dist/registry/chains.js +104 -0
- package/dist/registry/index.d.ts +4 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/index.js +6 -0
- package/dist/registry/registry.d.ts +38 -0
- package/dist/registry/registry.d.ts.map +1 -0
- package/dist/registry/registry.js +73 -0
- package/dist/registry/tokens/index.d.ts +11 -0
- package/dist/registry/tokens/index.d.ts.map +1 -0
- package/dist/registry/tokens/index.js +14 -0
- package/dist/registry/tokens/usdc.d.ts +27 -0
- package/dist/registry/tokens/usdc.d.ts.map +1 -0
- package/dist/registry/tokens/usdc.js +104 -0
- package/dist/types/domain.d.ts +24 -0
- package/dist/types/domain.d.ts.map +1 -0
- package/dist/types/domain.js +1 -0
- package/dist/types/erc3009.d.ts +38 -0
- package/dist/types/erc3009.d.ts.map +1 -0
- package/dist/types/erc3009.js +15 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/registry.d.ts +35 -0
- package/dist/types/registry.d.ts.map +1 -0
- package/dist/types/registry.js +1 -0
- package/dist/utils/hex.d.ts +13 -0
- package/dist/utils/hex.d.ts.map +1 -0
- package/dist/utils/hex.js +19 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/nonce.d.ts +5 -0
- package/dist/utils/nonce.d.ts.map +1 -0
- package/dist/utils/nonce.js +7 -0
- package/dist/utils/time.d.ts +13 -0
- package/dist/utils/time.d.ts.map +1 -0
- package/dist/utils/time.js +18 -0
- package/package.json +7 -8
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { TokenConfig } from "../../types/registry.js";
|
|
2
|
+
/**
|
|
3
|
+
* USDC token configurations across supported chains
|
|
4
|
+
*
|
|
5
|
+
* Note: These are the proxy addresses and EIP-712 domain parameters
|
|
6
|
+
* for the USDC contract on each chain.
|
|
7
|
+
*
|
|
8
|
+
* **IMPORTANT**: Domain names vary by network:
|
|
9
|
+
* - Base Mainnet (8453): name = "USD Coin"
|
|
10
|
+
* - Base Sepolia (84532): name = "USDC"
|
|
11
|
+
*
|
|
12
|
+
* Always use the correct domain name for signature verification to work.
|
|
13
|
+
*/
|
|
14
|
+
export declare const USDC: Record<number, TokenConfig>;
|
|
15
|
+
/**
|
|
16
|
+
* Get USDC configuration for a specific chain
|
|
17
|
+
*/
|
|
18
|
+
export declare function getUSDC(chainId: number): TokenConfig | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Check if USDC is supported on a chain
|
|
21
|
+
*/
|
|
22
|
+
export declare function isUSDCSupported(chainId: number): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* List all chains where USDC is configured
|
|
25
|
+
*/
|
|
26
|
+
export declare function listUSDCChains(): number[];
|
|
27
|
+
//# sourceMappingURL=usdc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usdc.d.ts","sourceRoot":"","sources":["../../../src/registry/tokens/usdc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAyE5C,CAAC;AAEF;;GAEG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAEhE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAExD;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,EAAE,CAEzC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* USDC token configurations across supported chains
|
|
3
|
+
*
|
|
4
|
+
* Note: These are the proxy addresses and EIP-712 domain parameters
|
|
5
|
+
* for the USDC contract on each chain.
|
|
6
|
+
*
|
|
7
|
+
* **IMPORTANT**: Domain names vary by network:
|
|
8
|
+
* - Base Mainnet (8453): name = "USD Coin"
|
|
9
|
+
* - Base Sepolia (84532): name = "USDC"
|
|
10
|
+
*
|
|
11
|
+
* Always use the correct domain name for signature verification to work.
|
|
12
|
+
*/
|
|
13
|
+
export const USDC = {
|
|
14
|
+
// Ethereum Mainnet
|
|
15
|
+
1: {
|
|
16
|
+
symbol: "USDC",
|
|
17
|
+
chainId: 1,
|
|
18
|
+
verifyingContract: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
19
|
+
name: "USD Coin",
|
|
20
|
+
version: "2",
|
|
21
|
+
decimals: 6,
|
|
22
|
+
},
|
|
23
|
+
// Ethereum Sepolia Testnet
|
|
24
|
+
11155111: {
|
|
25
|
+
symbol: "USDC",
|
|
26
|
+
chainId: 11155111,
|
|
27
|
+
verifyingContract: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
|
|
28
|
+
name: "USD Coin",
|
|
29
|
+
version: "2",
|
|
30
|
+
decimals: 6,
|
|
31
|
+
},
|
|
32
|
+
// Base Mainnet (domain name: "USD Coin")
|
|
33
|
+
8453: {
|
|
34
|
+
symbol: "USDC",
|
|
35
|
+
chainId: 8453,
|
|
36
|
+
verifyingContract: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
37
|
+
name: "USD Coin",
|
|
38
|
+
version: "2",
|
|
39
|
+
decimals: 6,
|
|
40
|
+
},
|
|
41
|
+
// Base Sepolia Testnet (domain name: "USDC")
|
|
42
|
+
84532: {
|
|
43
|
+
symbol: "USDC",
|
|
44
|
+
chainId: 84532,
|
|
45
|
+
verifyingContract: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
|
|
46
|
+
name: "USDC",
|
|
47
|
+
version: "2",
|
|
48
|
+
decimals: 6,
|
|
49
|
+
},
|
|
50
|
+
// Arbitrum One
|
|
51
|
+
42161: {
|
|
52
|
+
symbol: "USDC",
|
|
53
|
+
chainId: 42161,
|
|
54
|
+
verifyingContract: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
55
|
+
name: "USD Coin",
|
|
56
|
+
version: "2",
|
|
57
|
+
decimals: 6,
|
|
58
|
+
},
|
|
59
|
+
// Arbitrum Sepolia Testnet
|
|
60
|
+
421614: {
|
|
61
|
+
symbol: "USDC",
|
|
62
|
+
chainId: 421614,
|
|
63
|
+
verifyingContract: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",
|
|
64
|
+
name: "USD Coin",
|
|
65
|
+
version: "2",
|
|
66
|
+
decimals: 6,
|
|
67
|
+
},
|
|
68
|
+
// Polygon
|
|
69
|
+
137: {
|
|
70
|
+
symbol: "USDC",
|
|
71
|
+
chainId: 137,
|
|
72
|
+
verifyingContract: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
|
|
73
|
+
name: "USD Coin",
|
|
74
|
+
version: "2",
|
|
75
|
+
decimals: 6,
|
|
76
|
+
},
|
|
77
|
+
// Optimism
|
|
78
|
+
10: {
|
|
79
|
+
symbol: "USDC",
|
|
80
|
+
chainId: 10,
|
|
81
|
+
verifyingContract: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",
|
|
82
|
+
name: "USD Coin",
|
|
83
|
+
version: "2",
|
|
84
|
+
decimals: 6,
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Get USDC configuration for a specific chain
|
|
89
|
+
*/
|
|
90
|
+
export function getUSDC(chainId) {
|
|
91
|
+
return USDC[chainId];
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Check if USDC is supported on a chain
|
|
95
|
+
*/
|
|
96
|
+
export function isUSDCSupported(chainId) {
|
|
97
|
+
return chainId in USDC;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* List all chains where USDC is configured
|
|
101
|
+
*/
|
|
102
|
+
export function listUSDCChains() {
|
|
103
|
+
return Object.keys(USDC).map(Number);
|
|
104
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EIP-712 Domain structure
|
|
3
|
+
*/
|
|
4
|
+
export type EIP712Domain = {
|
|
5
|
+
name: string;
|
|
6
|
+
version: string;
|
|
7
|
+
chainId: number;
|
|
8
|
+
verifyingContract: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Partial domain for overrides
|
|
12
|
+
*/
|
|
13
|
+
export type DomainOverrides = Partial<EIP712Domain>;
|
|
14
|
+
/**
|
|
15
|
+
* Domain resolution parameters
|
|
16
|
+
*/
|
|
17
|
+
export type ResolveDomainParams = {
|
|
18
|
+
chainId: number;
|
|
19
|
+
token: string;
|
|
20
|
+
name?: string;
|
|
21
|
+
version?: string;
|
|
22
|
+
verifyingContract?: string;
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=domain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../../src/types/domain.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAEpD;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IAEd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ERC-3009 TransferWithAuthorization message structure
|
|
3
|
+
*/
|
|
4
|
+
export type TransferWithAuthorization = {
|
|
5
|
+
from: string;
|
|
6
|
+
to: string;
|
|
7
|
+
value: bigint;
|
|
8
|
+
validAfter: bigint;
|
|
9
|
+
validBefore: bigint;
|
|
10
|
+
nonce: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* ERC-3009 constants
|
|
14
|
+
*/
|
|
15
|
+
export declare const TRANSFER_WITH_AUTHORIZATION_TYPE = "TransferWithAuthorization";
|
|
16
|
+
/**
|
|
17
|
+
* EIP-712 type fields for TransferWithAuthorization
|
|
18
|
+
*/
|
|
19
|
+
export declare const TRANSFER_WITH_AUTHORIZATION_FIELDS: readonly [{
|
|
20
|
+
readonly name: "from";
|
|
21
|
+
readonly type: "address";
|
|
22
|
+
}, {
|
|
23
|
+
readonly name: "to";
|
|
24
|
+
readonly type: "address";
|
|
25
|
+
}, {
|
|
26
|
+
readonly name: "value";
|
|
27
|
+
readonly type: "uint256";
|
|
28
|
+
}, {
|
|
29
|
+
readonly name: "validAfter";
|
|
30
|
+
readonly type: "uint256";
|
|
31
|
+
}, {
|
|
32
|
+
readonly name: "validBefore";
|
|
33
|
+
readonly type: "uint256";
|
|
34
|
+
}, {
|
|
35
|
+
readonly name: "nonce";
|
|
36
|
+
readonly type: "bytes32";
|
|
37
|
+
}];
|
|
38
|
+
//# sourceMappingURL=erc3009.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erc3009.d.ts","sourceRoot":"","sources":["../../src/types/erc3009.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gCAAgC,8BAA8B,CAAC;AAE5E;;GAEG;AACH,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;EAOrC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ERC-3009 constants
|
|
3
|
+
*/
|
|
4
|
+
export const TRANSFER_WITH_AUTHORIZATION_TYPE = "TransferWithAuthorization";
|
|
5
|
+
/**
|
|
6
|
+
* EIP-712 type fields for TransferWithAuthorization
|
|
7
|
+
*/
|
|
8
|
+
export const TRANSFER_WITH_AUTHORIZATION_FIELDS = [
|
|
9
|
+
{ name: "from", type: "address" },
|
|
10
|
+
{ name: "to", type: "address" },
|
|
11
|
+
{ name: "value", type: "uint256" },
|
|
12
|
+
{ name: "validAfter", type: "uint256" },
|
|
13
|
+
{ name: "validBefore", type: "uint256" },
|
|
14
|
+
{ name: "nonce", type: "bytes32" },
|
|
15
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chain metadata
|
|
3
|
+
*/
|
|
4
|
+
export type ChainConfig = {
|
|
5
|
+
chainId: number;
|
|
6
|
+
name: string;
|
|
7
|
+
nativeCurrency: {
|
|
8
|
+
name: string;
|
|
9
|
+
symbol: string;
|
|
10
|
+
decimals: number;
|
|
11
|
+
};
|
|
12
|
+
rpcUrls?: string[];
|
|
13
|
+
blockExplorerUrls?: string[];
|
|
14
|
+
testnet?: boolean;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Token configuration for a specific chain
|
|
18
|
+
*/
|
|
19
|
+
export type TokenConfig = {
|
|
20
|
+
symbol: string;
|
|
21
|
+
chainId: number;
|
|
22
|
+
verifyingContract: `0x${string}`;
|
|
23
|
+
name: string;
|
|
24
|
+
version: string;
|
|
25
|
+
decimals?: number;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Token registry (symbol -> chainId -> config)
|
|
29
|
+
*/
|
|
30
|
+
export type TokenRegistry = {
|
|
31
|
+
[symbol: string]: {
|
|
32
|
+
[chainId: number]: TokenConfig;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/types/registry.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE;QACd,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,KAAK,MAAM,EAAE,CAAC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,CAAC,MAAM,EAAE,MAAM,GAAG;QAChB,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,CAAC;KAChC,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ensure hex string has 0x prefix
|
|
3
|
+
*/
|
|
4
|
+
export declare function ensureHex(value: string): string;
|
|
5
|
+
/**
|
|
6
|
+
* Normalize address to lowercase with 0x prefix
|
|
7
|
+
*/
|
|
8
|
+
export declare function normalizeAddress(address: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Check if string is valid bytes32 hex
|
|
11
|
+
*/
|
|
12
|
+
export declare function isBytes32Hex(value: string): boolean;
|
|
13
|
+
//# sourceMappingURL=hex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hex.d.ts","sourceRoot":"","sources":["../../src/utils/hex.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAGnD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ensure hex string has 0x prefix
|
|
3
|
+
*/
|
|
4
|
+
export function ensureHex(value) {
|
|
5
|
+
return value.startsWith("0x") ? value : `0x${value}`;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Normalize address to lowercase with 0x prefix
|
|
9
|
+
*/
|
|
10
|
+
export function normalizeAddress(address) {
|
|
11
|
+
return ensureHex(address.toLowerCase());
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Check if string is valid bytes32 hex
|
|
15
|
+
*/
|
|
16
|
+
export function isBytes32Hex(value) {
|
|
17
|
+
const hex = ensureHex(value);
|
|
18
|
+
return /^0x[0-9a-fA-F]{64}$/.test(hex);
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nonce.d.ts","sourceRoot":"","sources":["../../src/utils/nonce.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAEpC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get current Unix timestamp in seconds
|
|
3
|
+
*/
|
|
4
|
+
export declare function nowSeconds(): bigint;
|
|
5
|
+
/**
|
|
6
|
+
* Get Unix timestamp N seconds from now
|
|
7
|
+
*/
|
|
8
|
+
export declare function nowPlusSeconds(seconds: number): bigint;
|
|
9
|
+
/**
|
|
10
|
+
* Convert seconds to bigint
|
|
11
|
+
*/
|
|
12
|
+
export declare function toBigInt(value: number | bigint | string): bigint;
|
|
13
|
+
//# sourceMappingURL=time.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../src/utils/time.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAEhE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get current Unix timestamp in seconds
|
|
3
|
+
*/
|
|
4
|
+
export function nowSeconds() {
|
|
5
|
+
return BigInt(Math.floor(Date.now() / 1000));
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Get Unix timestamp N seconds from now
|
|
9
|
+
*/
|
|
10
|
+
export function nowPlusSeconds(seconds) {
|
|
11
|
+
return nowSeconds() + BigInt(seconds);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Convert seconds to bigint
|
|
15
|
+
*/
|
|
16
|
+
export function toBigInt(value) {
|
|
17
|
+
return BigInt(value);
|
|
18
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seapay-ai/erc3009",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "TypeScript utilities for ERC-3009 (Transfer With Authorization) EIP-712 signing",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"erc3009",
|
|
@@ -30,12 +30,6 @@
|
|
|
30
30
|
"README.md",
|
|
31
31
|
"LICENSE"
|
|
32
32
|
],
|
|
33
|
-
"scripts": {
|
|
34
|
-
"build": "tsc -b",
|
|
35
|
-
"prepublishOnly": "pnpm build",
|
|
36
|
-
"lint": "echo \"no lint configured\"",
|
|
37
|
-
"typecheck": "tsc --noEmit"
|
|
38
|
-
},
|
|
39
33
|
"dependencies": {
|
|
40
34
|
"ethers": "^6.16.0"
|
|
41
35
|
},
|
|
@@ -49,5 +43,10 @@
|
|
|
49
43
|
},
|
|
50
44
|
"publishConfig": {
|
|
51
45
|
"access": "public"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "tsc -b",
|
|
49
|
+
"lint": "echo \"no lint configured\"",
|
|
50
|
+
"typecheck": "tsc --noEmit"
|
|
52
51
|
}
|
|
53
|
-
}
|
|
52
|
+
}
|