@rhinestone/sdk 1.0.0-alpha.8 → 1.0.0-beta.38
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/src/accounts/error.d.ts +38 -3
- package/dist/src/accounts/error.d.ts.map +1 -1
- package/dist/src/accounts/error.js +57 -7
- package/dist/src/accounts/index.d.ts +30 -15
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +304 -138
- package/dist/src/accounts/index.test.js +3 -5
- package/dist/src/accounts/json-rpc/index.d.ts +5 -0
- package/dist/src/accounts/json-rpc/index.d.ts.map +1 -0
- package/dist/src/accounts/json-rpc/index.js +16 -0
- package/dist/src/accounts/json-rpc/index.test.d.ts.map +1 -0
- package/dist/src/accounts/json-rpc/index.test.js +16 -0
- package/dist/src/accounts/json-rpc/providers.d.ts +4 -0
- package/dist/src/accounts/json-rpc/providers.d.ts.map +1 -0
- package/dist/src/accounts/json-rpc/providers.js +14 -0
- package/dist/src/accounts/json-rpc/providers.test.d.ts +2 -0
- package/dist/src/accounts/json-rpc/providers.test.d.ts.map +1 -0
- package/dist/src/accounts/json-rpc/providers.test.js +15 -0
- package/dist/src/accounts/kernel.d.ts +4 -3
- package/dist/src/accounts/kernel.d.ts.map +1 -1
- package/dist/src/accounts/kernel.js +32 -6
- package/dist/src/accounts/kernel.test.js +41 -19
- package/dist/src/accounts/nexus.d.ts +14 -7
- package/dist/src/accounts/nexus.d.ts.map +1 -1
- package/dist/src/accounts/nexus.js +191 -34
- package/dist/src/accounts/nexus.test.js +44 -18
- package/dist/src/accounts/safe.d.ts +2 -2
- package/dist/src/accounts/safe.d.ts.map +1 -1
- package/dist/src/accounts/safe.js +88 -58
- package/dist/src/accounts/safe.test.js +40 -14
- package/dist/src/accounts/signing/common.d.ts +27 -0
- package/dist/src/accounts/signing/common.d.ts.map +1 -0
- package/dist/src/accounts/signing/common.js +145 -0
- package/dist/src/accounts/signing/message.d.ts +5 -0
- package/dist/src/accounts/signing/message.d.ts.map +1 -0
- package/dist/src/accounts/signing/message.js +47 -0
- package/dist/src/accounts/signing/passkeys.d.ts +36 -0
- package/dist/src/accounts/signing/passkeys.d.ts.map +1 -0
- package/dist/src/accounts/signing/passkeys.js +125 -0
- package/dist/src/accounts/signing/passkeys.test.d.ts +2 -0
- package/dist/src/accounts/signing/passkeys.test.d.ts.map +1 -0
- package/dist/src/accounts/signing/passkeys.test.js +88 -0
- package/dist/src/accounts/signing/typedData.d.ts +5 -0
- package/dist/src/accounts/signing/typedData.d.ts.map +1 -0
- package/dist/src/accounts/signing/typedData.js +35 -0
- package/dist/src/accounts/startale.d.ts +20 -0
- package/dist/src/accounts/startale.d.ts.map +1 -0
- package/dist/src/accounts/startale.js +100 -0
- package/dist/src/accounts/startale.test.d.ts +2 -0
- package/dist/src/accounts/startale.test.d.ts.map +1 -0
- package/dist/src/accounts/startale.test.js +92 -0
- package/dist/src/accounts/utils.d.ts +4 -4
- package/dist/src/accounts/utils.d.ts.map +1 -1
- package/dist/src/accounts/utils.js +3 -40
- package/dist/src/accounts/walletClient.d.ts +7 -0
- package/dist/src/accounts/walletClient.d.ts.map +1 -0
- package/dist/src/accounts/walletClient.js +38 -0
- package/dist/src/actions/compact.d.ts +13 -0
- package/dist/src/actions/compact.d.ts.map +1 -0
- package/dist/src/actions/compact.js +210 -0
- package/dist/src/actions/ecdsa.d.ts +35 -0
- package/dist/src/actions/ecdsa.d.ts.map +1 -0
- package/dist/src/actions/ecdsa.js +114 -0
- package/dist/src/actions/ecdsa.test.d.ts +2 -0
- package/dist/src/actions/ecdsa.test.d.ts.map +1 -0
- package/dist/src/actions/ecdsa.test.js +99 -0
- package/dist/src/actions/index.d.ts +23 -38
- package/dist/src/actions/index.d.ts.map +1 -1
- package/dist/src/actions/index.js +29 -294
- package/dist/src/actions/mfa.d.ts +37 -0
- package/dist/src/actions/mfa.d.ts.map +1 -0
- package/dist/src/actions/mfa.js +133 -0
- package/dist/src/actions/passkeys.d.ts +37 -0
- package/dist/src/actions/passkeys.d.ts.map +1 -0
- package/dist/src/actions/passkeys.js +129 -0
- package/dist/src/actions/passkeys.test.d.ts +2 -0
- package/dist/src/actions/passkeys.test.d.ts.map +1 -0
- package/dist/src/actions/passkeys.test.js +54 -0
- package/dist/src/actions/recovery.d.ts +33 -0
- package/dist/src/actions/recovery.d.ts.map +1 -0
- package/dist/src/actions/recovery.js +193 -0
- package/dist/src/actions/recovery.test.d.ts +2 -0
- package/dist/src/actions/recovery.test.d.ts.map +1 -0
- package/dist/src/actions/recovery.test.js +168 -0
- package/dist/src/actions/smart-session.d.ts +6 -0
- package/dist/src/actions/smart-session.d.ts.map +1 -1
- package/dist/src/actions/smart-session.js +6 -0
- package/dist/src/errors/index.d.ts +5 -0
- package/dist/src/errors/index.d.ts.map +1 -0
- package/dist/src/errors/index.js +35 -0
- package/dist/src/execution/compact.d.ts +150 -7
- package/dist/src/execution/compact.d.ts.map +1 -1
- package/dist/src/execution/compact.js +112 -95
- package/dist/src/execution/error.d.ts +2 -9
- package/dist/src/execution/error.d.ts.map +1 -1
- package/dist/src/execution/error.js +4 -13
- package/dist/src/execution/index.d.ts +34 -22
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +62 -43
- package/dist/src/execution/permit2.d.ts +148 -0
- package/dist/src/execution/permit2.d.ts.map +1 -0
- package/dist/src/execution/permit2.js +282 -0
- package/dist/src/execution/smart-session.d.ts +3 -3
- package/dist/src/execution/smart-session.d.ts.map +1 -1
- package/dist/src/execution/types.d.ts +35 -0
- package/dist/src/execution/types.d.ts.map +1 -0
- package/dist/src/execution/types.js +2 -0
- package/dist/src/execution/utils.d.ts +36 -27
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +357 -103
- package/dist/src/index.d.ts +41 -22
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +199 -65
- package/dist/src/modules/common.d.ts +10 -4
- package/dist/src/modules/common.d.ts.map +1 -1
- package/dist/src/modules/common.js +22 -1
- package/dist/src/modules/index.d.ts +4 -18
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +15 -63
- package/dist/src/modules/index.test.js +9 -26
- package/dist/src/modules/omni-account.d.ts +2 -1
- package/dist/src/modules/omni-account.d.ts.map +1 -1
- package/dist/src/modules/omni-account.js +3 -1
- package/dist/src/modules/read.d.ts.map +1 -1
- package/dist/src/modules/read.js +5 -0
- package/dist/src/modules/validators/core.d.ts +5 -3
- package/dist/src/modules/validators/core.d.ts.map +1 -1
- package/dist/src/modules/validators/core.js +64 -41
- package/dist/src/modules/validators/core.test.js +7 -7
- package/dist/src/modules/validators/smart-sessions.js +3 -3
- package/dist/src/modules/validators/smart-sessions.test.js +4 -7
- package/dist/src/orchestrator/client.d.ts +4 -4
- package/dist/src/orchestrator/client.d.ts.map +1 -1
- package/dist/src/orchestrator/client.js +30 -15
- package/dist/src/orchestrator/index.d.ts +2 -3
- package/dist/src/orchestrator/index.d.ts.map +1 -1
- package/dist/src/orchestrator/index.js +1 -3
- package/dist/src/orchestrator/registry.d.ts +1 -23
- package/dist/src/orchestrator/registry.d.ts.map +1 -1
- package/dist/src/orchestrator/registry.js +37 -33
- package/dist/src/orchestrator/registry.test.js +7 -7
- package/dist/src/orchestrator/types.d.ts +97 -29
- package/dist/src/orchestrator/types.d.ts.map +1 -1
- package/dist/src/orchestrator/utils.d.ts +1 -3
- package/dist/src/orchestrator/utils.d.ts.map +1 -1
- package/dist/src/orchestrator/utils.js +0 -102
- package/dist/src/types.d.ts +74 -10
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +72 -1
- package/dist/src/actions/index.test.d.ts.map +0 -1
- package/dist/src/actions/index.test.js +0 -302
- package/dist/src/orchestrator/registry.json +0 -365
- /package/dist/src/{actions → accounts/json-rpc}/index.test.d.ts +0 -0
|
@@ -1,8 +1,151 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type {
|
|
3
|
-
declare const COMPACT_ADDRESS = "
|
|
4
|
-
declare function
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { type Hex } from 'viem';
|
|
2
|
+
import type { IntentOp } from '../orchestrator/types';
|
|
3
|
+
declare const COMPACT_ADDRESS = "0x73d2dc0c21fca4ec1601895d50df7f5624f07d3f";
|
|
4
|
+
declare function getCompactTypedData(intentOp: IntentOp): {
|
|
5
|
+
readonly domain: {
|
|
6
|
+
readonly name: "The Compact";
|
|
7
|
+
readonly version: "1";
|
|
8
|
+
readonly chainId: bigint;
|
|
9
|
+
readonly verifyingContract: "0x73d2dc0c21fca4ec1601895d50df7f5624f07d3f";
|
|
10
|
+
};
|
|
11
|
+
readonly types: {
|
|
12
|
+
readonly MultichainCompact: readonly [{
|
|
13
|
+
readonly name: "sponsor";
|
|
14
|
+
readonly type: "address";
|
|
15
|
+
}, {
|
|
16
|
+
readonly name: "nonce";
|
|
17
|
+
readonly type: "uint256";
|
|
18
|
+
}, {
|
|
19
|
+
readonly name: "expires";
|
|
20
|
+
readonly type: "uint256";
|
|
21
|
+
}, {
|
|
22
|
+
readonly name: "elements";
|
|
23
|
+
readonly type: "Element[]";
|
|
24
|
+
}];
|
|
25
|
+
readonly Element: readonly [{
|
|
26
|
+
readonly name: "arbiter";
|
|
27
|
+
readonly type: "address";
|
|
28
|
+
}, {
|
|
29
|
+
readonly name: "chainId";
|
|
30
|
+
readonly type: "uint256";
|
|
31
|
+
}, {
|
|
32
|
+
readonly name: "commitments";
|
|
33
|
+
readonly type: "Lock[]";
|
|
34
|
+
}, {
|
|
35
|
+
readonly name: "mandate";
|
|
36
|
+
readonly type: "Mandate";
|
|
37
|
+
}];
|
|
38
|
+
readonly Lock: readonly [{
|
|
39
|
+
readonly name: "lockTag";
|
|
40
|
+
readonly type: "bytes12";
|
|
41
|
+
}, {
|
|
42
|
+
readonly name: "token";
|
|
43
|
+
readonly type: "address";
|
|
44
|
+
}, {
|
|
45
|
+
readonly name: "amount";
|
|
46
|
+
readonly type: "uint256";
|
|
47
|
+
}];
|
|
48
|
+
readonly Mandate: readonly [{
|
|
49
|
+
readonly name: "target";
|
|
50
|
+
readonly type: "Target";
|
|
51
|
+
}, {
|
|
52
|
+
readonly name: "v";
|
|
53
|
+
readonly type: "uint8";
|
|
54
|
+
}, {
|
|
55
|
+
readonly name: "minGas";
|
|
56
|
+
readonly type: "uint128";
|
|
57
|
+
}, {
|
|
58
|
+
readonly name: "originOps";
|
|
59
|
+
readonly type: "Op[]";
|
|
60
|
+
}, {
|
|
61
|
+
readonly name: "destOps";
|
|
62
|
+
readonly type: "Op[]";
|
|
63
|
+
}, {
|
|
64
|
+
readonly name: "q";
|
|
65
|
+
readonly type: "bytes32";
|
|
66
|
+
}];
|
|
67
|
+
readonly Target: readonly [{
|
|
68
|
+
readonly name: "recipient";
|
|
69
|
+
readonly type: "address";
|
|
70
|
+
}, {
|
|
71
|
+
readonly name: "tokenOut";
|
|
72
|
+
readonly type: "Token[]";
|
|
73
|
+
}, {
|
|
74
|
+
readonly name: "targetChain";
|
|
75
|
+
readonly type: "uint256";
|
|
76
|
+
}, {
|
|
77
|
+
readonly name: "fillExpiry";
|
|
78
|
+
readonly type: "uint256";
|
|
79
|
+
}];
|
|
80
|
+
readonly Token: readonly [{
|
|
81
|
+
readonly name: "token";
|
|
82
|
+
readonly type: "address";
|
|
83
|
+
}, {
|
|
84
|
+
readonly name: "amount";
|
|
85
|
+
readonly type: "uint256";
|
|
86
|
+
}];
|
|
87
|
+
readonly Op: readonly [{
|
|
88
|
+
readonly name: "to";
|
|
89
|
+
readonly type: "address";
|
|
90
|
+
}, {
|
|
91
|
+
readonly name: "value";
|
|
92
|
+
readonly type: "uint256";
|
|
93
|
+
}, {
|
|
94
|
+
readonly name: "data";
|
|
95
|
+
readonly type: "bytes";
|
|
96
|
+
}];
|
|
97
|
+
};
|
|
98
|
+
readonly primaryType: "MultichainCompact";
|
|
99
|
+
readonly message: {
|
|
100
|
+
readonly sponsor: `0x${string}`;
|
|
101
|
+
readonly nonce: bigint;
|
|
102
|
+
readonly expires: bigint;
|
|
103
|
+
readonly elements: {
|
|
104
|
+
arbiter: `0x${string}`;
|
|
105
|
+
chainId: bigint;
|
|
106
|
+
commitments: {
|
|
107
|
+
lockTag: `0x${string}`;
|
|
108
|
+
token: `0x${string}`;
|
|
109
|
+
amount: bigint;
|
|
110
|
+
}[];
|
|
111
|
+
mandate: {
|
|
112
|
+
target: {
|
|
113
|
+
recipient: `0x${string}`;
|
|
114
|
+
tokenOut: {
|
|
115
|
+
token: `0x${string}`;
|
|
116
|
+
amount: bigint;
|
|
117
|
+
}[];
|
|
118
|
+
targetChain: bigint;
|
|
119
|
+
fillExpiry: bigint;
|
|
120
|
+
};
|
|
121
|
+
v: number;
|
|
122
|
+
minGas: bigint;
|
|
123
|
+
originOps: {
|
|
124
|
+
to: `0x${string}`;
|
|
125
|
+
value: bigint;
|
|
126
|
+
data: `0x${string}`;
|
|
127
|
+
}[];
|
|
128
|
+
destOps: {
|
|
129
|
+
to: `0x${string}`;
|
|
130
|
+
value: bigint;
|
|
131
|
+
data: `0x${string}`;
|
|
132
|
+
}[];
|
|
133
|
+
q: `0x${string}`;
|
|
134
|
+
};
|
|
135
|
+
}[];
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* Get the compact digest for signing
|
|
140
|
+
* @param intentOp The intent operation
|
|
141
|
+
* @returns The digest hash
|
|
142
|
+
*/
|
|
143
|
+
declare function getCompactDigest(intentOp: IntentOp): Hex;
|
|
144
|
+
/**
|
|
145
|
+
* Get the Permit2 digest for signing
|
|
146
|
+
* @param intentOp The intent operation
|
|
147
|
+
* @returns The digest hash
|
|
148
|
+
*/
|
|
149
|
+
declare function getPermit2Digest(intentOp: IntentOp): Hex;
|
|
150
|
+
export { COMPACT_ADDRESS, getCompactTypedData, getCompactDigest, getPermit2Digest, };
|
|
8
151
|
//# sourceMappingURL=compact.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compact.d.ts","sourceRoot":"","sources":["../../../execution/compact.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"compact.d.ts","sourceRoot":"","sources":["../../../execution/compact.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAA0C,MAAM,MAAM,CAAA;AACvE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAGrD,QAAA,MAAM,eAAe,+CAA+C,CAAA;AA8CpE,iBAAS,mBAAmB,CAAC,QAAQ,EAAE,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmD9C;AAED;;;;GAIG;AACH,iBAAS,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,GAAG,CAGjD;AAED;;;;GAIG;AACH,iBAAS,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,GAAG,CAGjD;AAED,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,GACjB,CAAA"}
|
|
@@ -1,105 +1,122 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.COMPACT_ADDRESS = void 0;
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
4
|
+
exports.getCompactTypedData = getCompactTypedData;
|
|
5
|
+
exports.getCompactDigest = getCompactDigest;
|
|
6
|
+
exports.getPermit2Digest = getPermit2Digest;
|
|
7
7
|
const viem_1 = require("viem");
|
|
8
|
-
const
|
|
8
|
+
const permit2_1 = require("./permit2");
|
|
9
|
+
const COMPACT_ADDRESS = '0x73d2dc0c21fca4ec1601895d50df7f5624f07d3f';
|
|
9
10
|
exports.COMPACT_ADDRESS = COMPACT_ADDRESS;
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
11
|
+
// Define the typed data structure as const to preserve type safety
|
|
12
|
+
const COMPACT_TYPED_DATA_TYPES = {
|
|
13
|
+
MultichainCompact: [
|
|
14
|
+
{ name: 'sponsor', type: 'address' },
|
|
15
|
+
{ name: 'nonce', type: 'uint256' },
|
|
16
|
+
{ name: 'expires', type: 'uint256' },
|
|
17
|
+
{ name: 'elements', type: 'Element[]' },
|
|
18
|
+
],
|
|
19
|
+
Element: [
|
|
20
|
+
{ name: 'arbiter', type: 'address' },
|
|
21
|
+
{ name: 'chainId', type: 'uint256' },
|
|
22
|
+
{ name: 'commitments', type: 'Lock[]' },
|
|
23
|
+
{ name: 'mandate', type: 'Mandate' },
|
|
24
|
+
],
|
|
25
|
+
Lock: [
|
|
26
|
+
{ name: 'lockTag', type: 'bytes12' },
|
|
27
|
+
{ name: 'token', type: 'address' },
|
|
28
|
+
{ name: 'amount', type: 'uint256' },
|
|
29
|
+
],
|
|
30
|
+
Mandate: [
|
|
31
|
+
{ name: 'target', type: 'Target' },
|
|
32
|
+
{ name: 'v', type: 'uint8' },
|
|
33
|
+
{ name: 'minGas', type: 'uint128' },
|
|
34
|
+
{ name: 'originOps', type: 'Op[]' },
|
|
35
|
+
{ name: 'destOps', type: 'Op[]' },
|
|
36
|
+
{ name: 'q', type: 'bytes32' },
|
|
37
|
+
],
|
|
38
|
+
Target: [
|
|
39
|
+
{ name: 'recipient', type: 'address' },
|
|
40
|
+
{ name: 'tokenOut', type: 'Token[]' },
|
|
41
|
+
{ name: 'targetChain', type: 'uint256' },
|
|
42
|
+
{ name: 'fillExpiry', type: 'uint256' },
|
|
43
|
+
],
|
|
44
|
+
Token: [
|
|
45
|
+
{ name: 'token', type: 'address' },
|
|
46
|
+
{ name: 'amount', type: 'uint256' },
|
|
47
|
+
],
|
|
48
|
+
Op: [
|
|
49
|
+
{ name: 'to', type: 'address' },
|
|
50
|
+
{ name: 'value', type: 'uint256' },
|
|
51
|
+
{ name: 'data', type: 'bytes' },
|
|
52
|
+
],
|
|
53
|
+
};
|
|
54
|
+
function getCompactTypedData(intentOp) {
|
|
55
|
+
const typedData = {
|
|
56
|
+
domain: {
|
|
57
|
+
name: 'The Compact',
|
|
58
|
+
version: '1',
|
|
59
|
+
chainId: BigInt(intentOp.elements[0].chainId),
|
|
60
|
+
verifyingContract: '0x73d2dc0c21fca4ec1601895d50df7f5624f07d3f',
|
|
61
|
+
},
|
|
62
|
+
types: COMPACT_TYPED_DATA_TYPES,
|
|
63
|
+
primaryType: 'MultichainCompact',
|
|
64
|
+
message: {
|
|
65
|
+
sponsor: intentOp.sponsor,
|
|
66
|
+
nonce: BigInt(intentOp.nonce),
|
|
67
|
+
expires: BigInt(intentOp.expires),
|
|
68
|
+
elements: intentOp.elements.map((element) => ({
|
|
69
|
+
arbiter: element.arbiter,
|
|
70
|
+
chainId: BigInt(element.chainId),
|
|
71
|
+
commitments: element.idsAndAmounts.map((token) => ({
|
|
72
|
+
lockTag: (0, viem_1.slice)((0, viem_1.toHex)(BigInt(token[0])), 0, 12),
|
|
73
|
+
token: (0, viem_1.slice)((0, viem_1.toHex)(BigInt(token[0])), 12, 32),
|
|
74
|
+
amount: BigInt(token[1]),
|
|
75
|
+
})),
|
|
76
|
+
mandate: {
|
|
77
|
+
target: {
|
|
78
|
+
recipient: element.mandate.recipient,
|
|
79
|
+
tokenOut: element.mandate.tokenOut.map((token) => ({
|
|
80
|
+
token: (0, viem_1.slice)((0, viem_1.toHex)(BigInt(token[0])), 12, 32),
|
|
81
|
+
amount: BigInt(token[1]),
|
|
82
|
+
})),
|
|
83
|
+
targetChain: BigInt(element.mandate.destinationChainId),
|
|
84
|
+
fillExpiry: BigInt(element.mandate.fillDeadline),
|
|
85
|
+
},
|
|
86
|
+
v: element.mandate.v || 0,
|
|
87
|
+
minGas: BigInt(element.mandate.minGas || '0'),
|
|
88
|
+
originOps: element.mandate.preClaimOps.map((op) => ({
|
|
89
|
+
to: op.to,
|
|
90
|
+
value: BigInt(op.value),
|
|
91
|
+
data: op.data,
|
|
92
|
+
})),
|
|
93
|
+
destOps: element.mandate.destinationOps.map((op) => ({
|
|
94
|
+
to: op.to,
|
|
95
|
+
value: BigInt(op.value),
|
|
96
|
+
data: op.data,
|
|
97
|
+
})),
|
|
98
|
+
q: (0, viem_1.keccak256)(element.mandate.qualifier.encodedVal),
|
|
27
99
|
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
args: [lockTag(), account],
|
|
31
|
-
}),
|
|
32
|
-
value,
|
|
100
|
+
})),
|
|
101
|
+
},
|
|
33
102
|
};
|
|
103
|
+
return typedData;
|
|
34
104
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
name: 'depositERC20',
|
|
44
|
-
inputs: [
|
|
45
|
-
{
|
|
46
|
-
name: 'token',
|
|
47
|
-
type: 'address',
|
|
48
|
-
internalType: 'address',
|
|
49
|
-
},
|
|
50
|
-
{ name: 'lockTag', type: 'bytes12', internalType: 'bytes12' },
|
|
51
|
-
{ name: 'amount', type: 'uint256', internalType: 'uint256' },
|
|
52
|
-
{ name: 'recipient', type: 'address', internalType: 'address' },
|
|
53
|
-
],
|
|
54
|
-
outputs: [{ name: 'id', type: 'uint256', internalType: 'uint256' }],
|
|
55
|
-
stateMutability: 'nonpayable',
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
functionName: 'depositERC20',
|
|
59
|
-
args: [tokenAddress, lockTag(), amount, account],
|
|
60
|
-
}),
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
function getApproveErc20Call(tokenAddress, amount) {
|
|
64
|
-
return {
|
|
65
|
-
to: tokenAddress,
|
|
66
|
-
value: 0n,
|
|
67
|
-
data: (0, viem_1.encodeFunctionData)({
|
|
68
|
-
abi: viem_1.erc20Abi,
|
|
69
|
-
functionName: 'approve',
|
|
70
|
-
args: [COMPACT_ADDRESS, amount],
|
|
71
|
-
}),
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
function toCompactFlag(allocator) {
|
|
75
|
-
const addrBytes = Buffer.from(allocator.slice(2), 'hex');
|
|
76
|
-
let leadingZeroNibbles = 0;
|
|
77
|
-
for (const byte of addrBytes) {
|
|
78
|
-
if (byte === 0) {
|
|
79
|
-
leadingZeroNibbles += 2;
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
if (byte >> 4 === 0)
|
|
83
|
-
leadingZeroNibbles += 1;
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
if (leadingZeroNibbles >= 18)
|
|
88
|
-
return 15;
|
|
89
|
-
if (leadingZeroNibbles >= 4)
|
|
90
|
-
return leadingZeroNibbles - 3;
|
|
91
|
-
return 0;
|
|
92
|
-
}
|
|
93
|
-
function usingAllocatorId(allocator = ALLOCATOR_ADDRESS) {
|
|
94
|
-
const compactFlag = BigInt(toCompactFlag(allocator));
|
|
95
|
-
const last88Bits = BigInt(`0x${allocator.slice(-22)}`); // Extract last 88 bits (11 bytes * 2 hex chars per byte)
|
|
96
|
-
return (compactFlag << 88n) | last88Bits;
|
|
105
|
+
/**
|
|
106
|
+
* Get the compact digest for signing
|
|
107
|
+
* @param intentOp The intent operation
|
|
108
|
+
* @returns The digest hash
|
|
109
|
+
*/
|
|
110
|
+
function getCompactDigest(intentOp) {
|
|
111
|
+
const typedData = getCompactTypedData(intentOp);
|
|
112
|
+
return (0, viem_1.hashTypedData)(typedData);
|
|
97
113
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Get the Permit2 digest for signing
|
|
116
|
+
* @param intentOp The intent operation
|
|
117
|
+
* @returns The digest hash
|
|
118
|
+
*/
|
|
119
|
+
function getPermit2Digest(intentOp) {
|
|
120
|
+
const typedData = (0, permit2_1.getTypedData)(intentOp);
|
|
121
|
+
return (0, viem_1.hashTypedData)(typedData);
|
|
105
122
|
}
|
|
@@ -14,14 +14,7 @@ declare class ExecutionError extends Error {
|
|
|
14
14
|
get errorType(): string;
|
|
15
15
|
get traceId(): string;
|
|
16
16
|
}
|
|
17
|
-
declare class
|
|
18
|
-
constructor(params?: {
|
|
19
|
-
context?: any;
|
|
20
|
-
errorType?: string;
|
|
21
|
-
traceId?: string;
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
declare class UserOperationRequiredForSmartSessionsError extends ExecutionError {
|
|
17
|
+
declare class SignerNotSupportedError extends ExecutionError {
|
|
25
18
|
constructor(params?: {
|
|
26
19
|
context?: any;
|
|
27
20
|
errorType?: string;
|
|
@@ -50,5 +43,5 @@ declare class IntentFailedError extends ExecutionError {
|
|
|
50
43
|
});
|
|
51
44
|
}
|
|
52
45
|
declare function isExecutionError(error: Error): error is ExecutionError;
|
|
53
|
-
export { isExecutionError, ExecutionError,
|
|
46
|
+
export { isExecutionError, ExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError, IntentFailedError, SignerNotSupportedError, };
|
|
54
47
|
//# sourceMappingURL=error.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../execution/error.ts"],"names":[],"mappings":"AAAA,cAAM,cAAe,SAAQ,KAAK;IAChC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAK;IAC9B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAQ;IACnC,OAAO,CAAC,QAAQ,CAAC,QAAQ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AAQ,cAAc;gBACxC,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;CAOF;AAED,cAAM,iBAAkB,SAAQ,cAAc;gBAChC,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;CAMF;AAED,iBAAS,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,IAAI,cAAc,CAE/D;AAED,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,gCAAgC,EAChC,yBAAyB,EACzB,iBAAiB,EACjB,uBAAuB,GACxB,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.SignerNotSupportedError = exports.IntentFailedError = exports.SessionChainRequiredError = exports.OrderPathRequiredForIntentsError = exports.ExecutionError = void 0;
|
|
4
4
|
exports.isExecutionError = isExecutionError;
|
|
5
5
|
class ExecutionError extends Error {
|
|
6
6
|
_message;
|
|
@@ -28,24 +28,15 @@ class ExecutionError extends Error {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
exports.ExecutionError = ExecutionError;
|
|
31
|
-
class
|
|
31
|
+
class SignerNotSupportedError extends ExecutionError {
|
|
32
32
|
constructor(params) {
|
|
33
33
|
super({
|
|
34
|
-
message:
|
|
34
|
+
message: 'Sending a transaction is not supported for this type of signers. Use user operations instead.',
|
|
35
35
|
...params,
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
exports.
|
|
40
|
-
class UserOperationRequiredForSmartSessionsError extends ExecutionError {
|
|
41
|
-
constructor(params) {
|
|
42
|
-
super({
|
|
43
|
-
message: 'User operation is required when using smart sessions',
|
|
44
|
-
...params,
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
exports.UserOperationRequiredForSmartSessionsError = UserOperationRequiredForSmartSessionsError;
|
|
39
|
+
exports.SignerNotSupportedError = SignerNotSupportedError;
|
|
49
40
|
class OrderPathRequiredForIntentsError extends ExecutionError {
|
|
50
41
|
constructor(params) {
|
|
51
42
|
super({
|
|
@@ -1,24 +1,36 @@
|
|
|
1
|
-
import { type Address, type Chain } from 'viem';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
1
|
+
import { type Address, type Chain, type Hex } from 'viem';
|
|
2
|
+
import type { UserOperationReceipt } from 'viem/_types/account-abstraction';
|
|
3
|
+
import type { SettlementLayer } from '../orchestrator/types';
|
|
4
|
+
import type { CalldataInput, CallInput, RhinestoneAccountConfig, RhinestoneConfig, SignerSet, SourceAssetInput, TokenRequest, TokenSymbol, Transaction, UserOperationTransaction } from '../types';
|
|
5
|
+
import { ExecutionError, IntentFailedError, isExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SignerNotSupportedError } from './error';
|
|
6
|
+
import type { TransactionResult, UserOperationResult } from './utils';
|
|
7
|
+
interface TransactionStatus {
|
|
8
|
+
fill: {
|
|
9
|
+
hash: Hex | undefined;
|
|
10
|
+
chainId: number;
|
|
11
|
+
};
|
|
12
|
+
claims: {
|
|
13
|
+
hash: Hex | undefined;
|
|
14
|
+
chainId: number;
|
|
15
|
+
}[];
|
|
16
|
+
}
|
|
6
17
|
declare function sendTransaction(config: RhinestoneAccountConfig, transaction: Transaction): Promise<TransactionResult>;
|
|
7
|
-
declare function
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
declare function
|
|
21
|
-
declare function
|
|
22
|
-
|
|
23
|
-
export
|
|
18
|
+
declare function sendUserOperation(config: RhinestoneAccountConfig, transaction: UserOperationTransaction): Promise<UserOperationResult>;
|
|
19
|
+
declare function sendTransactionInternal(config: RhinestoneConfig, sourceChains: Chain[], targetChain: Chain, callInputs: CallInput[], options: {
|
|
20
|
+
gasLimit?: bigint;
|
|
21
|
+
initialTokenRequests?: TokenRequest[];
|
|
22
|
+
signers?: SignerSet;
|
|
23
|
+
sponsored?: boolean;
|
|
24
|
+
settlementLayers?: SettlementLayer[];
|
|
25
|
+
sourceAssets?: SourceAssetInput;
|
|
26
|
+
lockFunds?: boolean;
|
|
27
|
+
feeAsset?: Address | TokenSymbol;
|
|
28
|
+
dryRun?: boolean;
|
|
29
|
+
}): Promise<TransactionResult>;
|
|
30
|
+
declare function sendUserOperationInternal(config: RhinestoneConfig, chain: Chain, callInputs: CalldataInput[], signers?: SignerSet): Promise<UserOperationResult>;
|
|
31
|
+
declare function waitForExecution(config: RhinestoneConfig, result: TransactionResult | UserOperationResult, acceptsPreconfirmations: boolean): Promise<TransactionStatus | UserOperationReceipt>;
|
|
32
|
+
declare function getMaxSpendableAmount(config: RhinestoneConfig, chain: Chain, tokenAddress: Address, gasUnits: bigint, sponsored?: boolean): Promise<bigint>;
|
|
33
|
+
declare function getPortfolio(config: RhinestoneConfig, onTestnets: boolean): Promise<import("../orchestrator").Portfolio>;
|
|
34
|
+
export { sendTransaction, sendTransactionInternal, sendUserOperation, sendUserOperationInternal, waitForExecution, getMaxSpendableAmount, getPortfolio, isExecutionError, ExecutionError, IntentFailedError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SignerNotSupportedError, };
|
|
35
|
+
export type { TransactionStatus, TransactionResult, UserOperationResult };
|
|
24
36
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../execution/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK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