@axonfi/sdk 0.4.0 → 0.4.2
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 +15 -9
- package/dist/index.cjs +4325 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +3256 -0
- package/dist/index.d.ts +3256 -21
- package/dist/index.js +4261 -27
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/abis/AxonRegistry.d.ts +0 -294
- package/dist/abis/AxonRegistry.d.ts.map +0 -1
- package/dist/abis/AxonRegistry.js +0 -381
- package/dist/abis/AxonRegistry.js.map +0 -1
- package/dist/abis/AxonVault.d.ts +0 -1577
- package/dist/abis/AxonVault.d.ts.map +0 -1
- package/dist/abis/AxonVault.js +0 -2026
- package/dist/abis/AxonVault.js.map +0 -1
- package/dist/abis/AxonVaultFactory.d.ts +0 -207
- package/dist/abis/AxonVaultFactory.d.ts.map +0 -1
- package/dist/abis/AxonVaultFactory.js +0 -269
- package/dist/abis/AxonVaultFactory.js.map +0 -1
- package/dist/amounts.d.ts +0 -37
- package/dist/amounts.d.ts.map +0 -1
- package/dist/amounts.js +0 -72
- package/dist/amounts.js.map +0 -1
- package/dist/amounts.spec.d.ts +0 -2
- package/dist/amounts.spec.d.ts.map +0 -1
- package/dist/amounts.spec.js +0 -92
- package/dist/amounts.spec.js.map +0 -1
- package/dist/client.d.ts +0 -196
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -621
- package/dist/client.js.map +0 -1
- package/dist/client.spec.d.ts +0 -2
- package/dist/client.spec.d.ts.map +0 -1
- package/dist/client.spec.js +0 -437
- package/dist/client.spec.js.map +0 -1
- package/dist/constants.d.ts +0 -110
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -172
- package/dist/constants.js.map +0 -1
- package/dist/constants.spec.d.ts +0 -2
- package/dist/constants.spec.d.ts.map +0 -1
- package/dist/constants.spec.js +0 -95
- package/dist/constants.spec.js.map +0 -1
- package/dist/eip3009.d.ts +0 -45
- package/dist/eip3009.d.ts.map +0 -1
- package/dist/eip3009.js +0 -85
- package/dist/eip3009.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/keystore.d.ts +0 -60
- package/dist/keystore.d.ts.map +0 -1
- package/dist/keystore.js +0 -182
- package/dist/keystore.js.map +0 -1
- package/dist/keystore.spec.d.ts +0 -2
- package/dist/keystore.spec.d.ts.map +0 -1
- package/dist/keystore.spec.js +0 -71
- package/dist/keystore.spec.js.map +0 -1
- package/dist/permit2.d.ts +0 -45
- package/dist/permit2.d.ts.map +0 -1
- package/dist/permit2.js +0 -81
- package/dist/permit2.js.map +0 -1
- package/dist/signer.d.ts +0 -35
- package/dist/signer.d.ts.map +0 -1
- package/dist/signer.js +0 -132
- package/dist/signer.js.map +0 -1
- package/dist/signer.spec.d.ts +0 -2
- package/dist/signer.spec.d.ts.map +0 -1
- package/dist/signer.spec.js +0 -94
- package/dist/signer.spec.js.map +0 -1
- package/dist/tokens.d.ts +0 -215
- package/dist/tokens.d.ts.map +0 -1
- package/dist/tokens.js +0 -247
- package/dist/tokens.js.map +0 -1
- package/dist/types.d.ts +0 -302
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/utils.d.ts +0 -8
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -29
- package/dist/utils.js.map +0 -1
- package/dist/vault.d.ts +0 -60
- package/dist/vault.d.ts.map +0 -1
- package/dist/vault.js +0 -267
- package/dist/vault.js.map +0 -1
- package/dist/vault.spec.d.ts +0 -2
- package/dist/vault.spec.d.ts.map +0 -1
- package/dist/vault.spec.js +0 -162
- package/dist/vault.spec.js.map +0 -1
- package/dist/x402.d.ts +0 -88
- package/dist/x402.d.ts.map +0 -1
- package/dist/x402.js +0 -124
- package/dist/x402.js.map +0 -1
- package/dist/x402.spec.d.ts +0 -2
- package/dist/x402.spec.d.ts.map +0 -1
- package/dist/x402.spec.js +0 -411
- package/dist/x402.spec.js.map +0 -1
package/dist/keystore.js
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
// ============================================================================
|
|
2
|
-
// V3 Keystore — Encrypt / Decrypt bot private keys
|
|
3
|
-
// ============================================================================
|
|
4
|
-
//
|
|
5
|
-
// Standard Ethereum V3 keystore format (same as MetaMask / Geth).
|
|
6
|
-
// Uses scrypt KDF + AES-128-CTR cipher + keccak256 MAC.
|
|
7
|
-
import { scryptAsync } from '@noble/hashes/scrypt';
|
|
8
|
-
import { keccak_256 } from '@noble/hashes/sha3';
|
|
9
|
-
import { ctr } from '@noble/ciphers/aes';
|
|
10
|
-
import { privateKeyToAccount } from 'viem/accounts';
|
|
11
|
-
import { generateUuid } from './utils.js';
|
|
12
|
-
// ============================================================================
|
|
13
|
-
// Constants
|
|
14
|
-
// ============================================================================
|
|
15
|
-
const SCRYPT_N = 262144; // 2^18
|
|
16
|
-
const SCRYPT_R = 8;
|
|
17
|
-
const SCRYPT_P = 1;
|
|
18
|
-
const SCRYPT_DKLEN = 32;
|
|
19
|
-
// ============================================================================
|
|
20
|
-
// Helpers
|
|
21
|
-
// ============================================================================
|
|
22
|
-
function getRandomBytes(length) {
|
|
23
|
-
const bytes = new Uint8Array(length);
|
|
24
|
-
if (typeof crypto !== 'undefined' && crypto.getRandomValues) {
|
|
25
|
-
crypto.getRandomValues(bytes);
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
const { randomBytes } = require('crypto');
|
|
29
|
-
const buf = randomBytes(length);
|
|
30
|
-
for (let i = 0; i < length; i++)
|
|
31
|
-
bytes[i] = buf[i] ?? 0;
|
|
32
|
-
}
|
|
33
|
-
return bytes;
|
|
34
|
-
}
|
|
35
|
-
function hexToBytes(hex) {
|
|
36
|
-
const clean = hex.startsWith('0x') ? hex.slice(2) : hex;
|
|
37
|
-
const bytes = new Uint8Array(clean.length / 2);
|
|
38
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
39
|
-
bytes[i] = parseInt(clean.slice(i * 2, i * 2 + 2), 16);
|
|
40
|
-
}
|
|
41
|
-
return bytes;
|
|
42
|
-
}
|
|
43
|
-
function bytesToHex(bytes) {
|
|
44
|
-
return Array.from(bytes)
|
|
45
|
-
.map((b) => b.toString(16).padStart(2, '0'))
|
|
46
|
-
.join('');
|
|
47
|
-
}
|
|
48
|
-
// ============================================================================
|
|
49
|
-
// encryptKeystore
|
|
50
|
-
// ============================================================================
|
|
51
|
-
/**
|
|
52
|
-
* Encrypt a raw private key into a V3 keystore JSON object.
|
|
53
|
-
*
|
|
54
|
-
* Uses scrypt KDF (n=262144, r=8, p=1) and AES-128-CTR cipher —
|
|
55
|
-
* the same format as MetaMask and Geth.
|
|
56
|
-
*
|
|
57
|
-
* @param privateKey - Raw private key as 0x-prefixed hex string
|
|
58
|
-
* @param passphrase - Passphrase to encrypt with (min 1 character)
|
|
59
|
-
* @returns V3 keystore object ready to serialize as JSON
|
|
60
|
-
*
|
|
61
|
-
* @example
|
|
62
|
-
* ```ts
|
|
63
|
-
* import { encryptKeystore } from '@axonfi/sdk';
|
|
64
|
-
*
|
|
65
|
-
* const keystore = await encryptKeystore('0xabc...', 'my-strong-passphrase');
|
|
66
|
-
* fs.writeFileSync('bot-keystore.json', JSON.stringify(keystore, null, 2));
|
|
67
|
-
* ```
|
|
68
|
-
*/
|
|
69
|
-
export async function encryptKeystore(privateKey, passphrase) {
|
|
70
|
-
if (!passphrase)
|
|
71
|
-
throw new Error('Passphrase must not be empty');
|
|
72
|
-
const keyBytes = hexToBytes(privateKey);
|
|
73
|
-
const account = privateKeyToAccount(privateKey);
|
|
74
|
-
const address = account.address.slice(2).toLowerCase(); // no 0x prefix
|
|
75
|
-
// Random salt and IV
|
|
76
|
-
const salt = getRandomBytes(32);
|
|
77
|
-
const iv = getRandomBytes(16);
|
|
78
|
-
// Derive key via scrypt
|
|
79
|
-
const derivedKey = await scryptAsync(new TextEncoder().encode(passphrase), salt, {
|
|
80
|
-
N: SCRYPT_N,
|
|
81
|
-
r: SCRYPT_R,
|
|
82
|
-
p: SCRYPT_P,
|
|
83
|
-
dkLen: SCRYPT_DKLEN,
|
|
84
|
-
});
|
|
85
|
-
// Encrypt with AES-128-CTR (first 16 bytes of derived key)
|
|
86
|
-
const encryptionKey = derivedKey.slice(0, 16);
|
|
87
|
-
const cipher = ctr(encryptionKey, iv);
|
|
88
|
-
const ciphertext = cipher.encrypt(keyBytes);
|
|
89
|
-
// MAC = keccak256(derivedKey[16:32] ++ ciphertext)
|
|
90
|
-
const macInput = new Uint8Array(16 + ciphertext.length);
|
|
91
|
-
macInput.set(derivedKey.slice(16, 32), 0);
|
|
92
|
-
macInput.set(ciphertext, 16);
|
|
93
|
-
const mac = keccak_256(macInput);
|
|
94
|
-
return {
|
|
95
|
-
version: 3,
|
|
96
|
-
id: generateUuid(),
|
|
97
|
-
address,
|
|
98
|
-
crypto: {
|
|
99
|
-
ciphertext: bytesToHex(ciphertext),
|
|
100
|
-
cipherparams: { iv: bytesToHex(iv) },
|
|
101
|
-
cipher: 'aes-128-ctr',
|
|
102
|
-
kdf: 'scrypt',
|
|
103
|
-
kdfparams: {
|
|
104
|
-
dklen: SCRYPT_DKLEN,
|
|
105
|
-
salt: bytesToHex(salt),
|
|
106
|
-
n: SCRYPT_N,
|
|
107
|
-
r: SCRYPT_R,
|
|
108
|
-
p: SCRYPT_P,
|
|
109
|
-
},
|
|
110
|
-
mac: bytesToHex(mac),
|
|
111
|
-
},
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
// ============================================================================
|
|
115
|
-
// decryptKeystore
|
|
116
|
-
// ============================================================================
|
|
117
|
-
/**
|
|
118
|
-
* Decrypt a V3 keystore back to a raw private key.
|
|
119
|
-
*
|
|
120
|
-
* @param keystore - V3 keystore object or JSON string
|
|
121
|
-
* @param passphrase - Passphrase used during encryption
|
|
122
|
-
* @returns Raw private key as 0x-prefixed hex string
|
|
123
|
-
* @throws Error if passphrase is wrong (MAC mismatch) or keystore is invalid
|
|
124
|
-
*
|
|
125
|
-
* @example
|
|
126
|
-
* ```ts
|
|
127
|
-
* import { AxonClient, decryptKeystore } from '@axonfi/sdk';
|
|
128
|
-
*
|
|
129
|
-
* const keystore = JSON.parse(fs.readFileSync('bot-keystore.json', 'utf8'));
|
|
130
|
-
* const privateKey = await decryptKeystore(keystore, process.env.BOT_PASSPHRASE!);
|
|
131
|
-
* const client = new AxonClient({ botPrivateKey: privateKey, ... });
|
|
132
|
-
* ```
|
|
133
|
-
*/
|
|
134
|
-
export async function decryptKeystore(keystore, passphrase) {
|
|
135
|
-
// Parse JSON string if needed
|
|
136
|
-
let ks;
|
|
137
|
-
if (typeof keystore === 'string') {
|
|
138
|
-
try {
|
|
139
|
-
ks = JSON.parse(keystore);
|
|
140
|
-
}
|
|
141
|
-
catch {
|
|
142
|
-
throw new Error('Invalid keystore: could not parse JSON');
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
ks = keystore;
|
|
147
|
-
}
|
|
148
|
-
// Validate structure
|
|
149
|
-
if (ks.version !== 3)
|
|
150
|
-
throw new Error(`Unsupported keystore version: ${ks.version}`);
|
|
151
|
-
if (!ks.crypto)
|
|
152
|
-
throw new Error('Invalid keystore: missing crypto field');
|
|
153
|
-
if (ks.crypto.kdf !== 'scrypt')
|
|
154
|
-
throw new Error(`Unsupported KDF: ${ks.crypto.kdf}`);
|
|
155
|
-
if (ks.crypto.cipher !== 'aes-128-ctr')
|
|
156
|
-
throw new Error(`Unsupported cipher: ${ks.crypto.cipher}`);
|
|
157
|
-
const { kdfparams, ciphertext: ctHex, cipherparams, mac: expectedMacHex } = ks.crypto;
|
|
158
|
-
// Derive key via scrypt
|
|
159
|
-
const salt = hexToBytes(kdfparams.salt);
|
|
160
|
-
const derivedKey = await scryptAsync(new TextEncoder().encode(passphrase), salt, {
|
|
161
|
-
N: kdfparams.n,
|
|
162
|
-
r: kdfparams.r,
|
|
163
|
-
p: kdfparams.p,
|
|
164
|
-
dkLen: kdfparams.dklen,
|
|
165
|
-
});
|
|
166
|
-
// Verify MAC
|
|
167
|
-
const ciphertextBytes = hexToBytes(ctHex);
|
|
168
|
-
const macInput = new Uint8Array(16 + ciphertextBytes.length);
|
|
169
|
-
macInput.set(derivedKey.slice(16, 32), 0);
|
|
170
|
-
macInput.set(ciphertextBytes, 16);
|
|
171
|
-
const computedMac = bytesToHex(keccak_256(macInput));
|
|
172
|
-
if (computedMac !== expectedMacHex) {
|
|
173
|
-
throw new Error('Wrong passphrase: MAC mismatch');
|
|
174
|
-
}
|
|
175
|
-
// Decrypt with AES-128-CTR
|
|
176
|
-
const iv = hexToBytes(cipherparams.iv);
|
|
177
|
-
const encryptionKey = derivedKey.slice(0, 16);
|
|
178
|
-
const cipher = ctr(encryptionKey, iv);
|
|
179
|
-
const plaintext = cipher.decrypt(ciphertextBytes);
|
|
180
|
-
return `0x${bytesToHex(plaintext)}`;
|
|
181
|
-
}
|
|
182
|
-
//# sourceMappingURL=keystore.js.map
|
package/dist/keystore.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keystore.js","sourceRoot":"","sources":["../src/keystore.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,mDAAmD;AACnD,+EAA+E;AAC/E,EAAE;AACF,kEAAkE;AAClE,wDAAwD;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AA0B1C,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,OAAO;AAChC,MAAM,QAAQ,GAAG,CAAC,CAAC;AACnB,MAAM,QAAQ,GAAG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,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1C,QAAQ,CAAC,GAAG,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;IAClC,MAAM,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;IAErD,IAAI,WAAW,KAAK,cAAc,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACpD,CAAC;IAED,2BAA2B;IAC3B,MAAM,EAAE,GAAG,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;IACvC,MAAM,aAAa,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,GAAG,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;IACtC,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAElD,OAAO,KAAK,UAAU,CAAC,SAAS,CAAC,EAAS,CAAC;AAC7C,CAAC"}
|
package/dist/keystore.spec.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keystore.spec.d.ts","sourceRoot":"","sources":["../src/keystore.spec.ts"],"names":[],"mappings":""}
|
package/dist/keystore.spec.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { jest, describe, it, expect } from '@jest/globals';
|
|
2
|
-
import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts';
|
|
3
|
-
import { encryptKeystore, decryptKeystore } from './keystore.js';
|
|
4
|
-
// Scrypt is CPU-intensive — bump timeout for CI
|
|
5
|
-
jest.setTimeout(30000);
|
|
6
|
-
describe('keystore', () => {
|
|
7
|
-
const TEST_KEY = '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80';
|
|
8
|
-
const PASSPHRASE = 'test-passphrase-123';
|
|
9
|
-
describe('encryptKeystore', () => {
|
|
10
|
-
it('produces valid V3 keystore structure', async () => {
|
|
11
|
-
const ks = await encryptKeystore(TEST_KEY, PASSPHRASE);
|
|
12
|
-
expect(ks.version).toBe(3);
|
|
13
|
-
expect(ks.id).toMatch(/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/);
|
|
14
|
-
expect(ks.address).toMatch(/^[0-9a-f]{40}$/);
|
|
15
|
-
expect(ks.crypto.cipher).toBe('aes-128-ctr');
|
|
16
|
-
expect(ks.crypto.kdf).toBe('scrypt');
|
|
17
|
-
expect(ks.crypto.kdfparams.n).toBe(262144);
|
|
18
|
-
expect(ks.crypto.kdfparams.r).toBe(8);
|
|
19
|
-
expect(ks.crypto.kdfparams.p).toBe(1);
|
|
20
|
-
expect(ks.crypto.kdfparams.dklen).toBe(32);
|
|
21
|
-
expect(ks.crypto.ciphertext).toHaveLength(64); // 32 bytes hex
|
|
22
|
-
expect(ks.crypto.cipherparams.iv).toHaveLength(32); // 16 bytes hex
|
|
23
|
-
expect(ks.crypto.kdfparams.salt).toHaveLength(64); // 32 bytes hex
|
|
24
|
-
expect(ks.crypto.mac).toHaveLength(64); // 32 bytes hex
|
|
25
|
-
});
|
|
26
|
-
it('derives correct address', async () => {
|
|
27
|
-
const ks = await encryptKeystore(TEST_KEY, PASSPHRASE);
|
|
28
|
-
const expected = privateKeyToAccount(TEST_KEY).address.slice(2).toLowerCase();
|
|
29
|
-
expect(ks.address).toBe(expected);
|
|
30
|
-
});
|
|
31
|
-
it('throws on empty passphrase', async () => {
|
|
32
|
-
await expect(encryptKeystore(TEST_KEY, '')).rejects.toThrow('Passphrase must not be empty');
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
describe('decryptKeystore', () => {
|
|
36
|
-
it('round-trips: encrypt then decrypt returns original key', async () => {
|
|
37
|
-
const ks = await encryptKeystore(TEST_KEY, PASSPHRASE);
|
|
38
|
-
const decrypted = await decryptKeystore(ks, PASSPHRASE);
|
|
39
|
-
expect(decrypted).toBe(TEST_KEY);
|
|
40
|
-
});
|
|
41
|
-
it('works with a randomly generated key', async () => {
|
|
42
|
-
const randomKey = generatePrivateKey();
|
|
43
|
-
const ks = await encryptKeystore(randomKey, 'another-pass');
|
|
44
|
-
const decrypted = await decryptKeystore(ks, 'another-pass');
|
|
45
|
-
expect(decrypted).toBe(randomKey);
|
|
46
|
-
});
|
|
47
|
-
it('throws MAC mismatch on wrong passphrase', async () => {
|
|
48
|
-
const ks = await encryptKeystore(TEST_KEY, PASSPHRASE);
|
|
49
|
-
await expect(decryptKeystore(ks, 'wrong-password')).rejects.toThrow('Wrong passphrase: MAC mismatch');
|
|
50
|
-
});
|
|
51
|
-
it('accepts JSON string input', async () => {
|
|
52
|
-
const ks = await encryptKeystore(TEST_KEY, PASSPHRASE);
|
|
53
|
-
const jsonStr = JSON.stringify(ks);
|
|
54
|
-
const decrypted = await decryptKeystore(jsonStr, PASSPHRASE);
|
|
55
|
-
expect(decrypted).toBe(TEST_KEY);
|
|
56
|
-
});
|
|
57
|
-
it('throws on invalid JSON string', async () => {
|
|
58
|
-
await expect(decryptKeystore('not-json', PASSPHRASE)).rejects.toThrow('Invalid keystore: could not parse JSON');
|
|
59
|
-
});
|
|
60
|
-
it('throws on unsupported version', async () => {
|
|
61
|
-
const ks = await encryptKeystore(TEST_KEY, PASSPHRASE);
|
|
62
|
-
const bad = { ...ks, version: 2 };
|
|
63
|
-
await expect(decryptKeystore(bad, PASSPHRASE)).rejects.toThrow('Unsupported keystore version: 2');
|
|
64
|
-
});
|
|
65
|
-
it('throws on missing crypto field', async () => {
|
|
66
|
-
const bad = { version: 3, id: 'test', address: 'test' };
|
|
67
|
-
await expect(decryptKeystore(bad, PASSPHRASE)).rejects.toThrow('Invalid keystore: missing crypto field');
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
//# sourceMappingURL=keystore.spec.js.map
|
|
@@ -1 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EAAE,UAAU,CAAC,CAAC;YAC7D,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,+BAA+B,EAAE,KAAK,IAAI,EAAE;YAC7C,MAAM,MAAM,CAAC,eAAe,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,wCAAwC,CAAC,CAAC;QAClH,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,+BAA+B,EAAE,KAAK,IAAI,EAAE;YAC7C,MAAM,EAAE,GAAG,MAAM,eAAe,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;YACvD,MAAM,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,EAA2B,CAAC;YAC3D,MAAM,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,iCAAiC,CAAC,CAAC;QACpG,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,gCAAgC,EAAE,KAAK,IAAI,EAAE;YAC9C,MAAM,GAAG,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAA2B,CAAC;YACjF,MAAM,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,wCAAwC,CAAC,CAAC;QAC3G,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/permit2.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { Address, Hex } from 'viem';
|
|
2
|
-
/** Canonical Permit2 contract address (same on all EVM chains). */
|
|
3
|
-
export declare const PERMIT2_ADDRESS: Address;
|
|
4
|
-
/** x402 facilitator proxy contract address (same on all supported chains). */
|
|
5
|
-
export declare const X402_PROXY_ADDRESS: Address;
|
|
6
|
-
/**
|
|
7
|
-
* Witness type string for x402's PermitWitnessTransferFrom.
|
|
8
|
-
* Must match what the x402 facilitator contract expects.
|
|
9
|
-
*/
|
|
10
|
-
export declare const WITNESS_TYPE_STRING: "TransferDetails witness)TokenPermissions(address token,uint256 amount)TransferDetails(address to,uint256 requestedAmount)";
|
|
11
|
-
/** Parameters for Permit2 PermitWitnessTransferFrom. */
|
|
12
|
-
export interface Permit2Authorization {
|
|
13
|
-
/** Token to transfer. */
|
|
14
|
-
token: Address;
|
|
15
|
-
/** Maximum amount the spender can transfer. */
|
|
16
|
-
amount: bigint;
|
|
17
|
-
/** Spender address (the x402 proxy). */
|
|
18
|
-
spender: Address;
|
|
19
|
-
/** Unique nonce (random uint256). */
|
|
20
|
-
nonce: bigint;
|
|
21
|
-
/** Unix timestamp — signature is invalid after this time. */
|
|
22
|
-
deadline: bigint;
|
|
23
|
-
/** Witness: recipient address. */
|
|
24
|
-
witnessTo: Address;
|
|
25
|
-
/** Witness: requested amount. */
|
|
26
|
-
witnessRequestedAmount: bigint;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Generate a random uint256 nonce for Permit2.
|
|
30
|
-
* Uses crypto.getRandomValues for cryptographic randomness.
|
|
31
|
-
*/
|
|
32
|
-
export declare function randomPermit2Nonce(): bigint;
|
|
33
|
-
/**
|
|
34
|
-
* Sign a Permit2 PermitWitnessTransferFrom for x402.
|
|
35
|
-
*
|
|
36
|
-
* The resulting signature is submitted to the x402 facilitator proxy,
|
|
37
|
-
* which calls `Permit2.permitWitnessTransferFrom(...)` to settle the payment.
|
|
38
|
-
*
|
|
39
|
-
* @param privateKey - Signer's private key (token holder)
|
|
40
|
-
* @param chainId - Chain ID
|
|
41
|
-
* @param permit - Permit2 authorization parameters
|
|
42
|
-
* @returns EIP-712 signature (65 bytes, 0x-prefixed)
|
|
43
|
-
*/
|
|
44
|
-
export declare function signPermit2WitnessTransfer(privateKey: Hex, chainId: number, permit: Permit2Authorization): Promise<Hex>;
|
|
45
|
-
//# sourceMappingURL=permit2.d.ts.map
|
package/dist/permit2.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"permit2.d.ts","sourceRoot":"","sources":["../src/permit2.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAOzC,mEAAmE;AACnE,eAAO,MAAM,eAAe,EAAE,OAAsD,CAAC;AAErF,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB,EAAE,OAAsD,CAAC;AAExF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAC9B,2HAAoI,CAAC;AAqBvI,wDAAwD;AACxD,MAAM,WAAW,oBAAoB;IACnC,yBAAyB;IACzB,KAAK,EAAE,OAAO,CAAC;IACf,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf,wCAAwC;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,QAAQ,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,SAAS,EAAE,OAAO,CAAC;IACnB,iCAAiC;IACjC,sBAAsB,EAAE,MAAM,CAAC;CAChC;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAQ3C;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,0BAA0B,CAC9C,UAAU,EAAE,GAAG,EACf,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,GAAG,CAAC,CAyBd"}
|
package/dist/permit2.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { privateKeyToAccount } from 'viem/accounts';
|
|
2
|
-
// ============================================================================
|
|
3
|
-
// Permit2 — Universal token approvals (any ERC-20)
|
|
4
|
-
// ============================================================================
|
|
5
|
-
/** Canonical Permit2 contract address (same on all EVM chains). */
|
|
6
|
-
export const PERMIT2_ADDRESS = '0x000000000022D473030F116dDEE9F6B43aC78BA3';
|
|
7
|
-
/** x402 facilitator proxy contract address (same on all supported chains). */
|
|
8
|
-
export const X402_PROXY_ADDRESS = '0x4020CD856C882D5fb903D99CE35316A085Bb0001';
|
|
9
|
-
/**
|
|
10
|
-
* Witness type string for x402's PermitWitnessTransferFrom.
|
|
11
|
-
* Must match what the x402 facilitator contract expects.
|
|
12
|
-
*/
|
|
13
|
-
export const WITNESS_TYPE_STRING = 'TransferDetails witness)TokenPermissions(address token,uint256 amount)TransferDetails(address to,uint256 requestedAmount)';
|
|
14
|
-
/** EIP-712 types for Permit2 PermitWitnessTransferFrom with x402 witness. */
|
|
15
|
-
const PERMIT_WITNESS_TRANSFER_FROM_TYPES = {
|
|
16
|
-
PermitWitnessTransferFrom: [
|
|
17
|
-
{ name: 'permitted', type: 'TokenPermissions' },
|
|
18
|
-
{ name: 'spender', type: 'address' },
|
|
19
|
-
{ name: 'nonce', type: 'uint256' },
|
|
20
|
-
{ name: 'deadline', type: 'uint256' },
|
|
21
|
-
{ name: 'witness', type: 'TransferDetails' },
|
|
22
|
-
],
|
|
23
|
-
TokenPermissions: [
|
|
24
|
-
{ name: 'token', type: 'address' },
|
|
25
|
-
{ name: 'amount', type: 'uint256' },
|
|
26
|
-
],
|
|
27
|
-
TransferDetails: [
|
|
28
|
-
{ name: 'to', type: 'address' },
|
|
29
|
-
{ name: 'requestedAmount', type: 'uint256' },
|
|
30
|
-
],
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* Generate a random uint256 nonce for Permit2.
|
|
34
|
-
* Uses crypto.getRandomValues for cryptographic randomness.
|
|
35
|
-
*/
|
|
36
|
-
export function randomPermit2Nonce() {
|
|
37
|
-
const bytes = new Uint8Array(32);
|
|
38
|
-
crypto.getRandomValues(bytes);
|
|
39
|
-
let n = 0n;
|
|
40
|
-
for (const b of bytes) {
|
|
41
|
-
n = (n << 8n) | BigInt(b);
|
|
42
|
-
}
|
|
43
|
-
return n;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Sign a Permit2 PermitWitnessTransferFrom for x402.
|
|
47
|
-
*
|
|
48
|
-
* The resulting signature is submitted to the x402 facilitator proxy,
|
|
49
|
-
* which calls `Permit2.permitWitnessTransferFrom(...)` to settle the payment.
|
|
50
|
-
*
|
|
51
|
-
* @param privateKey - Signer's private key (token holder)
|
|
52
|
-
* @param chainId - Chain ID
|
|
53
|
-
* @param permit - Permit2 authorization parameters
|
|
54
|
-
* @returns EIP-712 signature (65 bytes, 0x-prefixed)
|
|
55
|
-
*/
|
|
56
|
-
export async function signPermit2WitnessTransfer(privateKey, chainId, permit) {
|
|
57
|
-
const account = privateKeyToAccount(privateKey);
|
|
58
|
-
return account.signTypedData({
|
|
59
|
-
domain: {
|
|
60
|
-
name: 'Permit2',
|
|
61
|
-
chainId,
|
|
62
|
-
verifyingContract: PERMIT2_ADDRESS,
|
|
63
|
-
},
|
|
64
|
-
types: PERMIT_WITNESS_TRANSFER_FROM_TYPES,
|
|
65
|
-
primaryType: 'PermitWitnessTransferFrom',
|
|
66
|
-
message: {
|
|
67
|
-
permitted: {
|
|
68
|
-
token: permit.token,
|
|
69
|
-
amount: permit.amount,
|
|
70
|
-
},
|
|
71
|
-
spender: permit.spender,
|
|
72
|
-
nonce: permit.nonce,
|
|
73
|
-
deadline: permit.deadline,
|
|
74
|
-
witness: {
|
|
75
|
-
to: permit.witnessTo,
|
|
76
|
-
requestedAmount: permit.witnessRequestedAmount,
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
//# sourceMappingURL=permit2.js.map
|
package/dist/permit2.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"permit2.js","sourceRoot":"","sources":["../src/permit2.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpD,+EAA+E;AAC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5B,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,UAAe,EACf,OAAe,EACf,MAA4B;IAE5B,MAAM,OAAO,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAEhD,OAAO,OAAO,CAAC,aAAa,CAAC;QAC3B,MAAM,EAAE;YACN,IAAI,EAAE,SAAS;YACf,OAAO;YACP,iBAAiB,EAAE,eAAe;SACnC;QACD,KAAK,EAAE,kCAAkC;QACzC,WAAW,EAAE,2BAA2B;QACxC,OAAO,EAAE;YACP,SAAS,EAAE;gBACT,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,MAAM,EAAE,MAAM,CAAC,MAAM;aACtB;YACD,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,OAAO,EAAE;gBACP,EAAE,EAAE,MAAM,CAAC,SAAS;gBACpB,eAAe,EAAE,MAAM,CAAC,sBAAsB;aAC/C;SACF;KACF,CAAC,CAAC;AACL,CAAC"}
|
package/dist/signer.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { WalletClient, Hex, Address } from 'viem';
|
|
2
|
-
import type { PaymentIntent, ExecuteIntent, SwapIntent } from './types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Sign a PaymentIntent using EIP-712 typed structured data.
|
|
5
|
-
*
|
|
6
|
-
* The resulting signature can be submitted to the Axon relayer API, which
|
|
7
|
-
* passes it to AxonVault.executePayment() on-chain.
|
|
8
|
-
*/
|
|
9
|
-
export declare function signPayment(walletClient: WalletClient, vaultAddress: Address, chainId: number, intent: PaymentIntent): Promise<Hex>;
|
|
10
|
-
/**
|
|
11
|
-
* Sign an ExecuteIntent using EIP-712 typed structured data.
|
|
12
|
-
*
|
|
13
|
-
* The resulting signature can be submitted to the Axon relayer API, which
|
|
14
|
-
* passes it to AxonVault.executeProtocol() on-chain.
|
|
15
|
-
*/
|
|
16
|
-
export declare function signExecuteIntent(walletClient: WalletClient, vaultAddress: Address, chainId: number, intent: ExecuteIntent): Promise<Hex>;
|
|
17
|
-
/**
|
|
18
|
-
* Sign a SwapIntent using EIP-712 typed structured data.
|
|
19
|
-
*
|
|
20
|
-
* The resulting signature can be submitted to the Axon relayer API, which
|
|
21
|
-
* passes it to AxonVault.executeSwap() on-chain.
|
|
22
|
-
*/
|
|
23
|
-
export declare function signSwapIntent(walletClient: WalletClient, vaultAddress: Address, chainId: number, intent: SwapIntent): Promise<Hex>;
|
|
24
|
-
/**
|
|
25
|
-
* Derive the on-chain `ref` bytes32 from a human-readable memo string.
|
|
26
|
-
*
|
|
27
|
-
* The full memo text is stored off-chain by the relayer (PostgreSQL), linked
|
|
28
|
-
* to the transaction. The keccak256 hash goes into the signed PaymentIntent
|
|
29
|
-
* and is emitted in the PaymentExecuted on-chain event.
|
|
30
|
-
*
|
|
31
|
-
* @param memo Human-readable description, e.g. "API call #1234 — weather data"
|
|
32
|
-
* @returns keccak256 hash of the UTF-8 encoded memo, as a bytes32 hex.
|
|
33
|
-
*/
|
|
34
|
-
export declare function encodeRef(memo: string): Hex;
|
|
35
|
-
//# sourceMappingURL=signer.d.ts.map
|
package/dist/signer.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAgD3E;;;;;GAKG;AACH,wBAAsB,WAAW,CAC/B,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,OAAO,EACrB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,GAAG,CAAC,CAmBd;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,OAAO,EACrB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,GAAG,CAAC,CAoBd;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,OAAO,EACrB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC,GAAG,CAAC,CAkBd;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAE3C"}
|
package/dist/signer.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { keccak256, stringToBytes } from 'viem';
|
|
2
|
-
import { EIP712_DOMAIN_NAME, EIP712_DOMAIN_VERSION } from './constants.js';
|
|
3
|
-
// EIP-712 types for PaymentIntent — field order matches the Solidity struct exactly.
|
|
4
|
-
const PAYMENT_INTENT_TYPES = {
|
|
5
|
-
PaymentIntent: [
|
|
6
|
-
{ name: 'bot', type: 'address' },
|
|
7
|
-
{ name: 'to', type: 'address' },
|
|
8
|
-
{ name: 'token', type: 'address' },
|
|
9
|
-
{ name: 'amount', type: 'uint256' },
|
|
10
|
-
{ name: 'deadline', type: 'uint256' },
|
|
11
|
-
{ name: 'ref', type: 'bytes32' },
|
|
12
|
-
],
|
|
13
|
-
};
|
|
14
|
-
// EIP-712 types for ExecuteIntent — DeFi protocol interactions.
|
|
15
|
-
const EXECUTE_INTENT_TYPES = {
|
|
16
|
-
ExecuteIntent: [
|
|
17
|
-
{ name: 'bot', type: 'address' },
|
|
18
|
-
{ name: 'protocol', type: 'address' },
|
|
19
|
-
{ name: 'calldataHash', type: 'bytes32' },
|
|
20
|
-
{ name: 'token', type: 'address' },
|
|
21
|
-
{ name: 'amount', type: 'uint256' },
|
|
22
|
-
{ name: 'deadline', type: 'uint256' },
|
|
23
|
-
{ name: 'ref', type: 'bytes32' },
|
|
24
|
-
],
|
|
25
|
-
};
|
|
26
|
-
// EIP-712 types for SwapIntent — in-vault token rebalancing.
|
|
27
|
-
const SWAP_INTENT_TYPES = {
|
|
28
|
-
SwapIntent: [
|
|
29
|
-
{ name: 'bot', type: 'address' },
|
|
30
|
-
{ name: 'toToken', type: 'address' },
|
|
31
|
-
{ name: 'minToAmount', type: 'uint256' },
|
|
32
|
-
{ name: 'deadline', type: 'uint256' },
|
|
33
|
-
{ name: 'ref', type: 'bytes32' },
|
|
34
|
-
],
|
|
35
|
-
};
|
|
36
|
-
function makeDomain(vaultAddress, chainId) {
|
|
37
|
-
return {
|
|
38
|
-
name: EIP712_DOMAIN_NAME,
|
|
39
|
-
version: EIP712_DOMAIN_VERSION,
|
|
40
|
-
chainId,
|
|
41
|
-
verifyingContract: vaultAddress,
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Sign a PaymentIntent using EIP-712 typed structured data.
|
|
46
|
-
*
|
|
47
|
-
* The resulting signature can be submitted to the Axon relayer API, which
|
|
48
|
-
* passes it to AxonVault.executePayment() on-chain.
|
|
49
|
-
*/
|
|
50
|
-
export async function signPayment(walletClient, vaultAddress, chainId, intent) {
|
|
51
|
-
if (!walletClient.account) {
|
|
52
|
-
throw new Error('walletClient has no account attached');
|
|
53
|
-
}
|
|
54
|
-
return walletClient.signTypedData({
|
|
55
|
-
account: walletClient.account,
|
|
56
|
-
domain: makeDomain(vaultAddress, chainId),
|
|
57
|
-
types: PAYMENT_INTENT_TYPES,
|
|
58
|
-
primaryType: 'PaymentIntent',
|
|
59
|
-
message: {
|
|
60
|
-
bot: intent.bot,
|
|
61
|
-
to: intent.to,
|
|
62
|
-
token: intent.token,
|
|
63
|
-
amount: intent.amount,
|
|
64
|
-
deadline: intent.deadline,
|
|
65
|
-
ref: intent.ref,
|
|
66
|
-
},
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Sign an ExecuteIntent using EIP-712 typed structured data.
|
|
71
|
-
*
|
|
72
|
-
* The resulting signature can be submitted to the Axon relayer API, which
|
|
73
|
-
* passes it to AxonVault.executeProtocol() on-chain.
|
|
74
|
-
*/
|
|
75
|
-
export async function signExecuteIntent(walletClient, vaultAddress, chainId, intent) {
|
|
76
|
-
if (!walletClient.account) {
|
|
77
|
-
throw new Error('walletClient has no account attached');
|
|
78
|
-
}
|
|
79
|
-
return walletClient.signTypedData({
|
|
80
|
-
account: walletClient.account,
|
|
81
|
-
domain: makeDomain(vaultAddress, chainId),
|
|
82
|
-
types: EXECUTE_INTENT_TYPES,
|
|
83
|
-
primaryType: 'ExecuteIntent',
|
|
84
|
-
message: {
|
|
85
|
-
bot: intent.bot,
|
|
86
|
-
protocol: intent.protocol,
|
|
87
|
-
calldataHash: intent.calldataHash,
|
|
88
|
-
token: intent.token,
|
|
89
|
-
amount: intent.amount,
|
|
90
|
-
deadline: intent.deadline,
|
|
91
|
-
ref: intent.ref,
|
|
92
|
-
},
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Sign a SwapIntent using EIP-712 typed structured data.
|
|
97
|
-
*
|
|
98
|
-
* The resulting signature can be submitted to the Axon relayer API, which
|
|
99
|
-
* passes it to AxonVault.executeSwap() on-chain.
|
|
100
|
-
*/
|
|
101
|
-
export async function signSwapIntent(walletClient, vaultAddress, chainId, intent) {
|
|
102
|
-
if (!walletClient.account) {
|
|
103
|
-
throw new Error('walletClient has no account attached');
|
|
104
|
-
}
|
|
105
|
-
return walletClient.signTypedData({
|
|
106
|
-
account: walletClient.account,
|
|
107
|
-
domain: makeDomain(vaultAddress, chainId),
|
|
108
|
-
types: SWAP_INTENT_TYPES,
|
|
109
|
-
primaryType: 'SwapIntent',
|
|
110
|
-
message: {
|
|
111
|
-
bot: intent.bot,
|
|
112
|
-
toToken: intent.toToken,
|
|
113
|
-
minToAmount: intent.minToAmount,
|
|
114
|
-
deadline: intent.deadline,
|
|
115
|
-
ref: intent.ref,
|
|
116
|
-
},
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Derive the on-chain `ref` bytes32 from a human-readable memo string.
|
|
121
|
-
*
|
|
122
|
-
* The full memo text is stored off-chain by the relayer (PostgreSQL), linked
|
|
123
|
-
* to the transaction. The keccak256 hash goes into the signed PaymentIntent
|
|
124
|
-
* and is emitted in the PaymentExecuted on-chain event.
|
|
125
|
-
*
|
|
126
|
-
* @param memo Human-readable description, e.g. "API call #1234 — weather data"
|
|
127
|
-
* @returns keccak256 hash of the UTF-8 encoded memo, as a bytes32 hex.
|
|
128
|
-
*/
|
|
129
|
-
export function encodeRef(memo) {
|
|
130
|
-
return keccak256(stringToBytes(memo));
|
|
131
|
-
}
|
|
132
|
-
//# sourceMappingURL=signer.js.map
|
package/dist/signer.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"signer.js","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAGhD,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAE3E,qFAAqF;AACrF,MAAM,oBAAoB,GAAG;IAC3B,aAAa,EAAE;QACb,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE;QAChC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE;QAC/B,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;QAClC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;QACnC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE;QACrC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,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