@towns-labs/relayer 2.0.13 → 2.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/dist/README.md +1 -1
- package/dist/index.js +145 -147
- package/dist/index.js.map +4 -4
- package/package.json +2 -2
- package/src/rpc/schema/intentTypes.ts +27 -0
- package/src/rpc/schema/prepareCalls.ts +3 -20
- package/src/rpc/schema/sendPreparedCalls.ts +1 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@towns-labs/relayer",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@scure/bip32": "2.0.1",
|
|
38
38
|
"@scure/bip39": "2.0.1",
|
|
39
39
|
"@slicekit/erc8128": "^0.1.0",
|
|
40
|
-
"@towns-labs/contracts": "^2.
|
|
40
|
+
"@towns-labs/contracts": "^2.1.1",
|
|
41
41
|
"hono": "^4.11.7",
|
|
42
42
|
"oxlint": "^1.41.0",
|
|
43
43
|
"pino": "10.2.0",
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical EIP-712 type definitions for intent signing/hashing.
|
|
3
|
+
*
|
|
4
|
+
* Must match Orchestrator contract's INTENT_TYPEHASH and CALL_TYPEHASH:
|
|
5
|
+
* "Intent(bool multichain,address eoa,Call[] calls,uint256 nonce,address payer,address paymentToken,uint256 paymentMaxAmount,uint256 combinedGas,bytes[] encodedPreCalls,bytes[] encodedFundTransfers,address settler,uint256 expiry)Call(address to,uint256 value,bytes data)"
|
|
6
|
+
*/
|
|
7
|
+
export const INTENT_TYPES = {
|
|
8
|
+
Intent: [
|
|
9
|
+
{ name: 'multichain', type: 'bool' },
|
|
10
|
+
{ name: 'eoa', type: 'address' },
|
|
11
|
+
{ name: 'calls', type: 'Call[]' },
|
|
12
|
+
{ name: 'nonce', type: 'uint256' },
|
|
13
|
+
{ name: 'payer', type: 'address' },
|
|
14
|
+
{ name: 'paymentToken', type: 'address' },
|
|
15
|
+
{ name: 'paymentMaxAmount', type: 'uint256' },
|
|
16
|
+
{ name: 'combinedGas', type: 'uint256' },
|
|
17
|
+
{ name: 'encodedPreCalls', type: 'bytes[]' },
|
|
18
|
+
{ name: 'encodedFundTransfers', type: 'bytes[]' },
|
|
19
|
+
{ name: 'settler', type: 'address' },
|
|
20
|
+
{ name: 'expiry', type: 'uint256' },
|
|
21
|
+
],
|
|
22
|
+
Call: [
|
|
23
|
+
{ name: 'to', type: 'address' },
|
|
24
|
+
{ name: 'value', type: 'uint256' },
|
|
25
|
+
{ name: 'data', type: 'bytes' },
|
|
26
|
+
],
|
|
27
|
+
} as const
|
|
@@ -9,20 +9,6 @@ export interface RpcCall {
|
|
|
9
9
|
value?: string // hex
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
* Key type for signing
|
|
14
|
-
*/
|
|
15
|
-
export type KeyType = 'secp256k1'
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Call key for signing
|
|
19
|
-
*/
|
|
20
|
-
export interface CallKey {
|
|
21
|
-
type: KeyType
|
|
22
|
-
publicKey: Hex
|
|
23
|
-
prehash: boolean
|
|
24
|
-
}
|
|
25
|
-
|
|
26
12
|
/**
|
|
27
13
|
* Parameters for wallet_prepareCalls
|
|
28
14
|
*/
|
|
@@ -30,11 +16,8 @@ export interface PrepareCallsParams {
|
|
|
30
16
|
from?: Address
|
|
31
17
|
chain_id: string // hex
|
|
32
18
|
calls: RpcCall[]
|
|
33
|
-
key
|
|
34
|
-
|
|
35
|
-
public_key: Hex
|
|
36
|
-
prehash?: boolean
|
|
37
|
-
}
|
|
19
|
+
/** Session key public key for gas simulation accuracy */
|
|
20
|
+
session_key?: Hex
|
|
38
21
|
capabilities?: {
|
|
39
22
|
meta?: {
|
|
40
23
|
fee_payer?: Address
|
|
@@ -43,6 +26,7 @@ export interface PrepareCallsParams {
|
|
|
43
26
|
nonce?: string
|
|
44
27
|
seq_key?: string
|
|
45
28
|
prepare_key?: string
|
|
29
|
+
expiry?: string
|
|
46
30
|
settler?: Address
|
|
47
31
|
settler_context?: Hex
|
|
48
32
|
}
|
|
@@ -177,6 +161,5 @@ export interface PrepareCallsResult {
|
|
|
177
161
|
message: Record<string, unknown>
|
|
178
162
|
}
|
|
179
163
|
capabilities: PrepareCallsCapabilities
|
|
180
|
-
key?: CallKey
|
|
181
164
|
signature: Hex
|
|
182
165
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Hex } from 'viem'
|
|
2
|
-
import type {
|
|
2
|
+
import type { PrepareCallsContext } from './prepareCalls'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Parameters for wallet_sendPreparedCalls (spec-compliant)
|
|
@@ -7,7 +7,6 @@ import type { CallKey, PrepareCallsContext } from './prepareCalls'
|
|
|
7
7
|
export interface SendPreparedCallsParams {
|
|
8
8
|
context: PrepareCallsContext
|
|
9
9
|
signature: Hex
|
|
10
|
-
key?: CallKey
|
|
11
10
|
/** Payment signature for third-party sponsorship (when payer != sender) */
|
|
12
11
|
paymentSignature?: Hex
|
|
13
12
|
capabilities?: {
|