@rhinestone/sdk 0.0.0-dev-20260204114155
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 +83 -0
- package/dist/src/accounts/error.d.ts +114 -0
- package/dist/src/accounts/error.d.ts.map +1 -0
- package/dist/src/accounts/error.js +174 -0
- package/dist/src/accounts/index.d.ts +48 -0
- package/dist/src/accounts/index.d.ts.map +1 -0
- package/dist/src/accounts/index.js +643 -0
- package/dist/src/accounts/index.test.d.ts +2 -0
- package/dist/src/accounts/index.test.d.ts.map +1 -0
- package/dist/src/accounts/index.test.js +33 -0
- 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 +20 -0
- package/dist/src/accounts/json-rpc/index.test.d.ts +2 -0
- package/dist/src/accounts/json-rpc/index.test.d.ts.map +1 -0
- package/dist/src/accounts/json-rpc/index.test.js +33 -0
- package/dist/src/accounts/json-rpc/providers.d.ts +5 -0
- package/dist/src/accounts/json-rpc/providers.d.ts.map +1 -0
- package/dist/src/accounts/json-rpc/providers.js +22 -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 +43 -0
- package/dist/src/accounts/kernel.d.ts +27 -0
- package/dist/src/accounts/kernel.d.ts.map +1 -0
- package/dist/src/accounts/kernel.js +281 -0
- package/dist/src/accounts/kernel.test.d.ts +2 -0
- package/dist/src/accounts/kernel.test.d.ts.map +1 -0
- package/dist/src/accounts/kernel.test.js +132 -0
- package/dist/src/accounts/nexus.d.ts +33 -0
- package/dist/src/accounts/nexus.d.ts.map +1 -0
- package/dist/src/accounts/nexus.js +455 -0
- package/dist/src/accounts/nexus.test.d.ts +2 -0
- package/dist/src/accounts/nexus.test.d.ts.map +1 -0
- package/dist/src/accounts/nexus.test.js +118 -0
- package/dist/src/accounts/passport.d.ts +9 -0
- package/dist/src/accounts/passport.d.ts.map +1 -0
- package/dist/src/accounts/passport.js +82 -0
- package/dist/src/accounts/safe.d.ts +33 -0
- package/dist/src/accounts/safe.d.ts.map +1 -0
- package/dist/src/accounts/safe.js +349 -0
- package/dist/src/accounts/safe.test.d.ts +2 -0
- package/dist/src/accounts/safe.test.d.ts.map +1 -0
- package/dist/src/accounts/safe.test.js +118 -0
- 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 +190 -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 +25 -0
- package/dist/src/accounts/startale.d.ts.map +1 -0
- package/dist/src/accounts/startale.js +112 -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 +33 -0
- package/dist/src/accounts/utils.d.ts.map +1 -0
- package/dist/src/accounts/utils.js +208 -0
- package/dist/src/accounts/utils.test.d.ts +2 -0
- package/dist/src/accounts/utils.test.d.ts.map +1 -0
- package/dist/src/accounts/utils.test.js +49 -0
- package/dist/src/accounts/walletClient.d.ts +34 -0
- package/dist/src/accounts/walletClient.d.ts.map +1 -0
- package/dist/src/accounts/walletClient.js +121 -0
- package/dist/src/actions/compact.d.ts +15 -0
- package/dist/src/actions/compact.d.ts.map +1 -0
- package/dist/src/actions/compact.js +213 -0
- package/dist/src/actions/deployment.d.ts +19 -0
- package/dist/src/actions/deployment.d.ts.map +1 -0
- package/dist/src/actions/deployment.js +78 -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 +17 -0
- package/dist/src/actions/index.d.ts.map +1 -0
- package/dist/src/actions/index.js +53 -0
- 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-sessions.d.ts +23 -0
- package/dist/src/actions/smart-sessions.d.ts.map +1 -0
- package/dist/src/actions/smart-sessions.js +52 -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 +54 -0
- package/dist/src/execution/compact.d.ts +148 -0
- package/dist/src/execution/compact.d.ts.map +1 -0
- package/dist/src/execution/compact.js +120 -0
- package/dist/src/execution/error.d.ts +55 -0
- package/dist/src/execution/error.d.ts.map +1 -0
- package/dist/src/execution/error.js +78 -0
- package/dist/src/execution/index.d.ts +41 -0
- package/dist/src/execution/index.d.ts.map +1 -0
- package/dist/src/execution/index.js +230 -0
- package/dist/src/execution/permit2.d.ts +143 -0
- package/dist/src/execution/permit2.d.ts.map +1 -0
- package/dist/src/execution/permit2.js +285 -0
- package/dist/src/execution/singleChainOps.d.ts +40 -0
- package/dist/src/execution/singleChainOps.d.ts.map +1 -0
- package/dist/src/execution/singleChainOps.js +46 -0
- package/dist/src/execution/types.d.ts +36 -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 +87 -0
- package/dist/src/execution/utils.d.ts.map +1 -0
- package/dist/src/execution/utils.js +783 -0
- package/dist/src/index.d.ts +76 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +319 -0
- package/dist/src/modules/abi/smart-session-emissary.d.ts +696 -0
- package/dist/src/modules/abi/smart-session-emissary.d.ts.map +1 -0
- package/dist/src/modules/abi/smart-session-emissary.js +565 -0
- package/dist/src/modules/abi/smart-sessions.d.ts +104 -0
- package/dist/src/modules/abi/smart-sessions.d.ts.map +1 -0
- package/dist/src/modules/abi/smart-sessions.js +131 -0
- package/dist/src/modules/chain-abstraction.d.ts +5 -0
- package/dist/src/modules/chain-abstraction.d.ts.map +1 -0
- package/dist/src/modules/chain-abstraction.js +7 -0
- package/dist/src/modules/common.d.ts +30 -0
- package/dist/src/modules/common.d.ts.map +1 -0
- package/dist/src/modules/common.js +42 -0
- package/dist/src/modules/index.d.ts +11 -0
- package/dist/src/modules/index.d.ts.map +1 -0
- package/dist/src/modules/index.js +97 -0
- package/dist/src/modules/index.test.d.ts +2 -0
- package/dist/src/modules/index.test.d.ts.map +1 -0
- package/dist/src/modules/index.test.js +81 -0
- package/dist/src/modules/legacy.d.ts +10 -0
- package/dist/src/modules/legacy.d.ts.map +1 -0
- package/dist/src/modules/legacy.js +65 -0
- package/dist/src/modules/read.d.ts +9 -0
- package/dist/src/modules/read.d.ts.map +1 -0
- package/dist/src/modules/read.js +125 -0
- package/dist/src/modules/validators/core.d.ts +31 -0
- package/dist/src/modules/validators/core.d.ts.map +1 -0
- package/dist/src/modules/validators/core.js +284 -0
- package/dist/src/modules/validators/core.test.d.ts +2 -0
- package/dist/src/modules/validators/core.test.d.ts.map +1 -0
- package/dist/src/modules/validators/core.test.js +101 -0
- package/dist/src/modules/validators/index.d.ts +4 -0
- package/dist/src/modules/validators/index.d.ts.map +1 -0
- package/dist/src/modules/validators/index.js +10 -0
- package/dist/src/modules/validators/smart-sessions.d.ts +185 -0
- package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions.js +624 -0
- package/dist/src/orchestrator/client.d.ts +22 -0
- package/dist/src/orchestrator/client.d.ts.map +1 -0
- package/dist/src/orchestrator/client.js +360 -0
- package/dist/src/orchestrator/consts.d.ts +5 -0
- package/dist/src/orchestrator/consts.d.ts.map +1 -0
- package/dist/src/orchestrator/consts.js +9 -0
- package/dist/src/orchestrator/error.d.ts +242 -0
- package/dist/src/orchestrator/error.d.ts.map +1 -0
- package/dist/src/orchestrator/error.js +283 -0
- package/dist/src/orchestrator/index.d.ts +10 -0
- package/dist/src/orchestrator/index.d.ts.map +1 -0
- package/dist/src/orchestrator/index.js +58 -0
- package/dist/src/orchestrator/registry.d.ts +22 -0
- package/dist/src/orchestrator/registry.d.ts.map +1 -0
- package/dist/src/orchestrator/registry.js +116 -0
- package/dist/src/orchestrator/registry.test.d.ts +2 -0
- package/dist/src/orchestrator/registry.test.d.ts.map +1 -0
- package/dist/src/orchestrator/registry.test.js +154 -0
- package/dist/src/orchestrator/types.d.ts +322 -0
- package/dist/src/orchestrator/types.d.ts.map +1 -0
- package/dist/src/orchestrator/types.js +31 -0
- package/dist/src/orchestrator/utils.d.ts +3 -0
- package/dist/src/orchestrator/utils.d.ts.map +1 -0
- package/dist/src/orchestrator/utils.js +24 -0
- package/dist/src/types.d.ts +296 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +2 -0
- package/dist/src/utils/index.d.ts +26 -0
- package/dist/src/utils/index.d.ts.map +1 -0
- package/dist/src/utils/index.js +63 -0
- package/dist/test/consts.d.ts +10 -0
- package/dist/test/consts.d.ts.map +1 -0
- package/dist/test/consts.js +22 -0
- package/dist/test/utils/utils.d.ts +5 -0
- package/dist/test/utils/utils.d.ts.map +1 -0
- package/dist/test/utils/utils.js +20 -0
- package/package.json +161 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { type Hex } from 'viem';
|
|
2
|
+
import type { IntentOp, IntentOpElement } from '../orchestrator/types';
|
|
3
|
+
declare const SCOPE_MULTICHAIN = 0;
|
|
4
|
+
declare const RESET_PERIOD_ONE_WEEK = 6;
|
|
5
|
+
declare const COMPACT_ADDRESS = "0x00000000000000171ede64904551eeDF3C6C9788";
|
|
6
|
+
declare function getCompactTypedData(intentOp: IntentOp): {
|
|
7
|
+
readonly domain: {
|
|
8
|
+
readonly name: "The Compact";
|
|
9
|
+
readonly version: "1";
|
|
10
|
+
readonly chainId: number;
|
|
11
|
+
readonly verifyingContract: "0x73d2dc0c21fca4ec1601895d50df7f5624f07d3f";
|
|
12
|
+
};
|
|
13
|
+
readonly types: {
|
|
14
|
+
readonly MultichainCompact: readonly [{
|
|
15
|
+
readonly name: "sponsor";
|
|
16
|
+
readonly type: "address";
|
|
17
|
+
}, {
|
|
18
|
+
readonly name: "nonce";
|
|
19
|
+
readonly type: "uint256";
|
|
20
|
+
}, {
|
|
21
|
+
readonly name: "expires";
|
|
22
|
+
readonly type: "uint256";
|
|
23
|
+
}, {
|
|
24
|
+
readonly name: "elements";
|
|
25
|
+
readonly type: "Element[]";
|
|
26
|
+
}];
|
|
27
|
+
readonly Element: readonly [{
|
|
28
|
+
readonly name: "arbiter";
|
|
29
|
+
readonly type: "address";
|
|
30
|
+
}, {
|
|
31
|
+
readonly name: "chainId";
|
|
32
|
+
readonly type: "uint256";
|
|
33
|
+
}, {
|
|
34
|
+
readonly name: "commitments";
|
|
35
|
+
readonly type: "Lock[]";
|
|
36
|
+
}, {
|
|
37
|
+
readonly name: "mandate";
|
|
38
|
+
readonly type: "Mandate";
|
|
39
|
+
}];
|
|
40
|
+
readonly Lock: readonly [{
|
|
41
|
+
readonly name: "lockTag";
|
|
42
|
+
readonly type: "bytes12";
|
|
43
|
+
}, {
|
|
44
|
+
readonly name: "token";
|
|
45
|
+
readonly type: "address";
|
|
46
|
+
}, {
|
|
47
|
+
readonly name: "amount";
|
|
48
|
+
readonly type: "uint256";
|
|
49
|
+
}];
|
|
50
|
+
readonly Mandate: readonly [{
|
|
51
|
+
readonly name: "target";
|
|
52
|
+
readonly type: "Target";
|
|
53
|
+
}, {
|
|
54
|
+
readonly name: "minGas";
|
|
55
|
+
readonly type: "uint128";
|
|
56
|
+
}, {
|
|
57
|
+
readonly name: "originOps";
|
|
58
|
+
readonly type: "Op";
|
|
59
|
+
}, {
|
|
60
|
+
readonly name: "destOps";
|
|
61
|
+
readonly type: "Op";
|
|
62
|
+
}, {
|
|
63
|
+
readonly name: "q";
|
|
64
|
+
readonly type: "bytes32";
|
|
65
|
+
}];
|
|
66
|
+
readonly Target: readonly [{
|
|
67
|
+
readonly name: "recipient";
|
|
68
|
+
readonly type: "address";
|
|
69
|
+
}, {
|
|
70
|
+
readonly name: "tokenOut";
|
|
71
|
+
readonly type: "Token[]";
|
|
72
|
+
}, {
|
|
73
|
+
readonly name: "targetChain";
|
|
74
|
+
readonly type: "uint256";
|
|
75
|
+
}, {
|
|
76
|
+
readonly name: "fillExpiry";
|
|
77
|
+
readonly type: "uint256";
|
|
78
|
+
}];
|
|
79
|
+
readonly Token: readonly [{
|
|
80
|
+
readonly name: "token";
|
|
81
|
+
readonly type: "address";
|
|
82
|
+
}, {
|
|
83
|
+
readonly name: "amount";
|
|
84
|
+
readonly type: "uint256";
|
|
85
|
+
}];
|
|
86
|
+
readonly Op: readonly [{
|
|
87
|
+
readonly name: "vt";
|
|
88
|
+
readonly type: "bytes32";
|
|
89
|
+
}, {
|
|
90
|
+
readonly name: "ops";
|
|
91
|
+
readonly type: "Ops[]";
|
|
92
|
+
}];
|
|
93
|
+
readonly Ops: readonly [{
|
|
94
|
+
readonly name: "to";
|
|
95
|
+
readonly type: "address";
|
|
96
|
+
}, {
|
|
97
|
+
readonly name: "value";
|
|
98
|
+
readonly type: "uint256";
|
|
99
|
+
}, {
|
|
100
|
+
readonly name: "data";
|
|
101
|
+
readonly type: "bytes";
|
|
102
|
+
}];
|
|
103
|
+
};
|
|
104
|
+
readonly primaryType: "MultichainCompact";
|
|
105
|
+
readonly message: {
|
|
106
|
+
readonly sponsor: `0x${string}`;
|
|
107
|
+
readonly nonce: bigint;
|
|
108
|
+
readonly expires: bigint;
|
|
109
|
+
readonly elements: {
|
|
110
|
+
arbiter: `0x${string}`;
|
|
111
|
+
chainId: bigint;
|
|
112
|
+
commitments: {
|
|
113
|
+
lockTag: `0x${string}`;
|
|
114
|
+
token: `0x${string}`;
|
|
115
|
+
amount: bigint;
|
|
116
|
+
}[];
|
|
117
|
+
mandate: {
|
|
118
|
+
target: {
|
|
119
|
+
recipient: `0x${string}`;
|
|
120
|
+
tokenOut: {
|
|
121
|
+
token: `0x${string}`;
|
|
122
|
+
amount: bigint;
|
|
123
|
+
}[];
|
|
124
|
+
targetChain: bigint;
|
|
125
|
+
fillExpiry: bigint;
|
|
126
|
+
};
|
|
127
|
+
minGas: bigint;
|
|
128
|
+
originOps: import("../orchestrator/types").Op;
|
|
129
|
+
destOps: import("../orchestrator/types").Op;
|
|
130
|
+
q: `0x${string}`;
|
|
131
|
+
};
|
|
132
|
+
}[];
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Get the compact digest for signing
|
|
137
|
+
* @param intentOp The intent operation
|
|
138
|
+
* @returns The digest hash
|
|
139
|
+
*/
|
|
140
|
+
declare function getCompactDigest(intentOp: IntentOp): Hex;
|
|
141
|
+
/**
|
|
142
|
+
* Get the Permit2 digest for signing
|
|
143
|
+
* @param intentOp The intent operation
|
|
144
|
+
* @returns The digest hash
|
|
145
|
+
*/
|
|
146
|
+
declare function getPermit2Digest(element: IntentOpElement, nonce: bigint, expires: bigint): Hex;
|
|
147
|
+
export { SCOPE_MULTICHAIN, RESET_PERIOD_ONE_WEEK, COMPACT_ADDRESS, getCompactTypedData, getCompactDigest, getPermit2Digest, };
|
|
148
|
+
//# sourceMappingURL=compact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAGtE,QAAA,MAAM,gBAAgB,IAAI,CAAA;AAC1B,QAAA,MAAM,qBAAqB,IAAI,CAAA;AAE/B,QAAA,MAAM,eAAe,+CAA+C,CAAA;AAiDpE,iBAAS,mBAAmB,CAAC,QAAQ,EAAE,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0C9C;AAED;;;;GAIG;AACH,iBAAS,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,GAAG,CAGjD;AAED;;;;GAIG;AACH,iBAAS,gBAAgB,CACvB,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,GACd,GAAG,CAGL;AAED,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,GACjB,CAAA"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.COMPACT_ADDRESS = exports.RESET_PERIOD_ONE_WEEK = exports.SCOPE_MULTICHAIN = void 0;
|
|
4
|
+
exports.getCompactTypedData = getCompactTypedData;
|
|
5
|
+
exports.getCompactDigest = getCompactDigest;
|
|
6
|
+
exports.getPermit2Digest = getPermit2Digest;
|
|
7
|
+
const viem_1 = require("viem");
|
|
8
|
+
const permit2_1 = require("./permit2");
|
|
9
|
+
const SCOPE_MULTICHAIN = 0;
|
|
10
|
+
exports.SCOPE_MULTICHAIN = SCOPE_MULTICHAIN;
|
|
11
|
+
const RESET_PERIOD_ONE_WEEK = 6;
|
|
12
|
+
exports.RESET_PERIOD_ONE_WEEK = RESET_PERIOD_ONE_WEEK;
|
|
13
|
+
const COMPACT_ADDRESS = '0x00000000000000171ede64904551eeDF3C6C9788';
|
|
14
|
+
exports.COMPACT_ADDRESS = COMPACT_ADDRESS;
|
|
15
|
+
// Define the typed data structure as const to preserve type safety
|
|
16
|
+
const COMPACT_TYPED_DATA_TYPES = {
|
|
17
|
+
MultichainCompact: [
|
|
18
|
+
{ name: 'sponsor', type: 'address' },
|
|
19
|
+
{ name: 'nonce', type: 'uint256' },
|
|
20
|
+
{ name: 'expires', type: 'uint256' },
|
|
21
|
+
{ name: 'elements', type: 'Element[]' },
|
|
22
|
+
],
|
|
23
|
+
Element: [
|
|
24
|
+
{ name: 'arbiter', type: 'address' },
|
|
25
|
+
{ name: 'chainId', type: 'uint256' },
|
|
26
|
+
{ name: 'commitments', type: 'Lock[]' },
|
|
27
|
+
{ name: 'mandate', type: 'Mandate' },
|
|
28
|
+
],
|
|
29
|
+
Lock: [
|
|
30
|
+
{ name: 'lockTag', type: 'bytes12' },
|
|
31
|
+
{ name: 'token', type: 'address' },
|
|
32
|
+
{ name: 'amount', type: 'uint256' },
|
|
33
|
+
],
|
|
34
|
+
Mandate: [
|
|
35
|
+
{ name: 'target', type: 'Target' },
|
|
36
|
+
{ name: 'minGas', type: 'uint128' },
|
|
37
|
+
{ name: 'originOps', type: 'Op' },
|
|
38
|
+
{ name: 'destOps', type: 'Op' },
|
|
39
|
+
{ name: 'q', type: 'bytes32' },
|
|
40
|
+
],
|
|
41
|
+
Target: [
|
|
42
|
+
{ name: 'recipient', type: 'address' },
|
|
43
|
+
{ name: 'tokenOut', type: 'Token[]' },
|
|
44
|
+
{ name: 'targetChain', type: 'uint256' },
|
|
45
|
+
{ name: 'fillExpiry', type: 'uint256' },
|
|
46
|
+
],
|
|
47
|
+
Token: [
|
|
48
|
+
{ name: 'token', type: 'address' },
|
|
49
|
+
{ name: 'amount', type: 'uint256' },
|
|
50
|
+
],
|
|
51
|
+
Op: [
|
|
52
|
+
{ name: 'vt', type: 'bytes32' },
|
|
53
|
+
{ name: 'ops', type: 'Ops[]' },
|
|
54
|
+
],
|
|
55
|
+
Ops: [
|
|
56
|
+
{ name: 'to', type: 'address' },
|
|
57
|
+
{ name: 'value', type: 'uint256' },
|
|
58
|
+
{ name: 'data', type: 'bytes' },
|
|
59
|
+
],
|
|
60
|
+
};
|
|
61
|
+
function getCompactTypedData(intentOp) {
|
|
62
|
+
const typedData = {
|
|
63
|
+
domain: {
|
|
64
|
+
name: 'The Compact',
|
|
65
|
+
version: '1',
|
|
66
|
+
chainId: Number(intentOp.elements[0].chainId),
|
|
67
|
+
verifyingContract: '0x73d2dc0c21fca4ec1601895d50df7f5624f07d3f',
|
|
68
|
+
},
|
|
69
|
+
types: COMPACT_TYPED_DATA_TYPES,
|
|
70
|
+
primaryType: 'MultichainCompact',
|
|
71
|
+
message: {
|
|
72
|
+
sponsor: intentOp.sponsor,
|
|
73
|
+
nonce: BigInt(intentOp.nonce),
|
|
74
|
+
expires: BigInt(intentOp.expires),
|
|
75
|
+
elements: intentOp.elements.map((element) => ({
|
|
76
|
+
arbiter: element.arbiter,
|
|
77
|
+
chainId: BigInt(element.chainId),
|
|
78
|
+
commitments: element.idsAndAmounts.map((token) => ({
|
|
79
|
+
lockTag: (0, viem_1.slice)((0, viem_1.toHex)(BigInt(token[0])), 0, 12),
|
|
80
|
+
token: (0, viem_1.slice)((0, viem_1.toHex)(BigInt(token[0])), 12, 32),
|
|
81
|
+
amount: BigInt(token[1]),
|
|
82
|
+
})),
|
|
83
|
+
mandate: {
|
|
84
|
+
target: {
|
|
85
|
+
recipient: element.mandate.recipient,
|
|
86
|
+
tokenOut: element.mandate.tokenOut.map((token) => ({
|
|
87
|
+
token: (0, viem_1.slice)((0, viem_1.toHex)(BigInt(token[0])), 12, 32),
|
|
88
|
+
amount: BigInt(token[1]),
|
|
89
|
+
})),
|
|
90
|
+
targetChain: BigInt(element.mandate.destinationChainId),
|
|
91
|
+
fillExpiry: BigInt(element.mandate.fillDeadline),
|
|
92
|
+
},
|
|
93
|
+
minGas: BigInt(element.mandate.minGas),
|
|
94
|
+
originOps: element.mandate.preClaimOps,
|
|
95
|
+
destOps: element.mandate.destinationOps,
|
|
96
|
+
q: (0, viem_1.keccak256)(element.mandate.qualifier.encodedVal),
|
|
97
|
+
},
|
|
98
|
+
})),
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
return typedData;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Get the compact digest for signing
|
|
105
|
+
* @param intentOp The intent operation
|
|
106
|
+
* @returns The digest hash
|
|
107
|
+
*/
|
|
108
|
+
function getCompactDigest(intentOp) {
|
|
109
|
+
const typedData = getCompactTypedData(intentOp);
|
|
110
|
+
return (0, viem_1.hashTypedData)(typedData);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Get the Permit2 digest for signing
|
|
114
|
+
* @param intentOp The intent operation
|
|
115
|
+
* @returns The digest hash
|
|
116
|
+
*/
|
|
117
|
+
function getPermit2Digest(element, nonce, expires) {
|
|
118
|
+
const typedData = (0, permit2_1.getTypedData)(element, nonce, expires);
|
|
119
|
+
return (0, viem_1.hashTypedData)(typedData);
|
|
120
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
declare class ExecutionError extends Error {
|
|
2
|
+
private readonly _message;
|
|
3
|
+
private readonly _context;
|
|
4
|
+
private readonly _errorType;
|
|
5
|
+
private readonly _traceId;
|
|
6
|
+
constructor(params?: {
|
|
7
|
+
message?: string;
|
|
8
|
+
context?: any;
|
|
9
|
+
errorType?: string;
|
|
10
|
+
traceId?: string;
|
|
11
|
+
});
|
|
12
|
+
get message(): string;
|
|
13
|
+
get context(): any;
|
|
14
|
+
get errorType(): string;
|
|
15
|
+
get traceId(): string;
|
|
16
|
+
}
|
|
17
|
+
declare class SignerNotSupportedError extends ExecutionError {
|
|
18
|
+
constructor(params?: {
|
|
19
|
+
context?: any;
|
|
20
|
+
errorType?: string;
|
|
21
|
+
traceId?: string;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
declare class OrderPathRequiredForIntentsError extends ExecutionError {
|
|
25
|
+
constructor(params?: {
|
|
26
|
+
context?: any;
|
|
27
|
+
errorType?: string;
|
|
28
|
+
traceId?: string;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
declare class SessionChainRequiredError extends ExecutionError {
|
|
32
|
+
constructor(params?: {
|
|
33
|
+
context?: any;
|
|
34
|
+
errorType?: string;
|
|
35
|
+
traceId?: string;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
declare class IntentFailedError extends ExecutionError {
|
|
39
|
+
constructor(params?: {
|
|
40
|
+
intentId?: string;
|
|
41
|
+
context?: any;
|
|
42
|
+
errorType?: string;
|
|
43
|
+
traceId?: string;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
declare class IntentStatusTimeoutError extends ExecutionError {
|
|
47
|
+
constructor(params?: {
|
|
48
|
+
context?: any;
|
|
49
|
+
errorType?: string;
|
|
50
|
+
traceId?: string;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
declare function isExecutionError(error: Error): error is ExecutionError;
|
|
54
|
+
export { isExecutionError, ExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError, IntentFailedError, IntentStatusTimeoutError, SignerNotSupportedError, };
|
|
55
|
+
//# sourceMappingURL=error.d.ts.map
|
|
@@ -0,0 +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,CAAQ;gBAErB,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;IAQD,IAAI,OAAO,WAEV;IAED,IAAI,OAAO,QAEV;IAED,IAAI,SAAS,WAEZ;IAED,IAAI,OAAO,WAEV;CACF;AAED,cAAM,uBAAwB,SAAQ,cAAc;gBACtC,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,gCAAiC,SAAQ,cAAc;gBAC/C,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;CAMF;AAED,cAAM,yBAA0B,SAAQ,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,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;CAMF;AAED,cAAM,wBAAyB,SAAQ,cAAc;gBACvC,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,wBAAwB,EACxB,uBAAuB,GACxB,CAAA"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SignerNotSupportedError = exports.IntentStatusTimeoutError = exports.IntentFailedError = exports.SessionChainRequiredError = exports.OrderPathRequiredForIntentsError = exports.ExecutionError = void 0;
|
|
4
|
+
exports.isExecutionError = isExecutionError;
|
|
5
|
+
class ExecutionError extends Error {
|
|
6
|
+
_message;
|
|
7
|
+
_context;
|
|
8
|
+
_errorType;
|
|
9
|
+
_traceId;
|
|
10
|
+
constructor(params) {
|
|
11
|
+
super();
|
|
12
|
+
this._message = params?.message || 'ExecutionError';
|
|
13
|
+
this._context = params?.context || {};
|
|
14
|
+
this._errorType = params?.errorType || 'Unknown';
|
|
15
|
+
this._traceId = params?.traceId || '';
|
|
16
|
+
}
|
|
17
|
+
get message() {
|
|
18
|
+
return this._message;
|
|
19
|
+
}
|
|
20
|
+
get context() {
|
|
21
|
+
return this._context;
|
|
22
|
+
}
|
|
23
|
+
get errorType() {
|
|
24
|
+
return this._errorType;
|
|
25
|
+
}
|
|
26
|
+
get traceId() {
|
|
27
|
+
return this._traceId;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.ExecutionError = ExecutionError;
|
|
31
|
+
class SignerNotSupportedError extends ExecutionError {
|
|
32
|
+
constructor(params) {
|
|
33
|
+
super({
|
|
34
|
+
message: 'Sending a transaction is not supported for this type of signers. Use user operations instead.',
|
|
35
|
+
...params,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.SignerNotSupportedError = SignerNotSupportedError;
|
|
40
|
+
class OrderPathRequiredForIntentsError extends ExecutionError {
|
|
41
|
+
constructor(params) {
|
|
42
|
+
super({
|
|
43
|
+
message: 'Order path is required when using intents',
|
|
44
|
+
...params,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.OrderPathRequiredForIntentsError = OrderPathRequiredForIntentsError;
|
|
49
|
+
class SessionChainRequiredError extends ExecutionError {
|
|
50
|
+
constructor(params) {
|
|
51
|
+
super({
|
|
52
|
+
message: 'Specifying a chain is required when using multi-chain smart sessions',
|
|
53
|
+
...params,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.SessionChainRequiredError = SessionChainRequiredError;
|
|
58
|
+
class IntentFailedError extends ExecutionError {
|
|
59
|
+
constructor(params) {
|
|
60
|
+
super({
|
|
61
|
+
message: 'Intent failed',
|
|
62
|
+
...params,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.IntentFailedError = IntentFailedError;
|
|
67
|
+
class IntentStatusTimeoutError extends ExecutionError {
|
|
68
|
+
constructor(params) {
|
|
69
|
+
super({
|
|
70
|
+
message: 'Intent status polling timed out',
|
|
71
|
+
...params,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.IntentStatusTimeoutError = IntentStatusTimeoutError;
|
|
76
|
+
function isExecutionError(error) {
|
|
77
|
+
return error instanceof ExecutionError;
|
|
78
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type Address, type Chain, type Hex } from 'viem';
|
|
2
|
+
import type { UserOperationReceipt } from 'viem/_types/account-abstraction';
|
|
3
|
+
import type { IntentOpStatus, SplitIntentsInput } from '../orchestrator';
|
|
4
|
+
import type { SettlementLayer } from '../orchestrator/types';
|
|
5
|
+
import type { CalldataInput, CallInput, RhinestoneAccountConfig, RhinestoneConfig, SignerSet, SourceAssetInput, Sponsorship, TokenRequest, TokenSymbol, Transaction, UserOperationTransaction } from '../types';
|
|
6
|
+
import { ExecutionError, IntentFailedError, IntentStatusTimeoutError, isExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SignerNotSupportedError } from './error';
|
|
7
|
+
import type { TransactionResult, UserOperationResult } from './utils';
|
|
8
|
+
interface TransactionStatus {
|
|
9
|
+
fill: {
|
|
10
|
+
hash: Hex | undefined;
|
|
11
|
+
chainId: number;
|
|
12
|
+
};
|
|
13
|
+
claims: {
|
|
14
|
+
hash: Hex | undefined;
|
|
15
|
+
chainId: number;
|
|
16
|
+
}[];
|
|
17
|
+
}
|
|
18
|
+
declare function sendTransaction(config: RhinestoneAccountConfig, transaction: Transaction): Promise<TransactionResult>;
|
|
19
|
+
declare function sendUserOperation(config: RhinestoneAccountConfig, transaction: UserOperationTransaction): Promise<UserOperationResult>;
|
|
20
|
+
declare function sendTransactionInternal(config: RhinestoneConfig, sourceChains: Chain[] | undefined, targetChain: Chain, options: {
|
|
21
|
+
callInputs?: CallInput[];
|
|
22
|
+
gasLimit?: bigint;
|
|
23
|
+
initialTokenRequests?: TokenRequest[];
|
|
24
|
+
recipient?: RhinestoneAccountConfig | Address;
|
|
25
|
+
signers?: SignerSet;
|
|
26
|
+
sponsored?: Sponsorship;
|
|
27
|
+
settlementLayers?: SettlementLayer[];
|
|
28
|
+
sourceAssets?: SourceAssetInput;
|
|
29
|
+
lockFunds?: boolean;
|
|
30
|
+
feeAsset?: Address | TokenSymbol;
|
|
31
|
+
}): Promise<TransactionResult>;
|
|
32
|
+
declare function sendUserOperationInternal(config: RhinestoneConfig, chain: Chain, callInputs: CalldataInput[], signers?: SignerSet): Promise<UserOperationResult>;
|
|
33
|
+
declare function waitForExecution(config: RhinestoneConfig, result: TransactionResult | UserOperationResult, acceptsPreconfirmations: boolean): Promise<TransactionStatus | UserOperationReceipt>;
|
|
34
|
+
declare function getPortfolio(config: RhinestoneConfig, onTestnets: boolean): Promise<import("../orchestrator").Portfolio>;
|
|
35
|
+
declare function getIntentStatus(apiKey: string | undefined, endpointUrl: string | undefined, intentId: bigint): Promise<TransactionStatus & {
|
|
36
|
+
status: IntentOpStatus['status'];
|
|
37
|
+
}>;
|
|
38
|
+
declare function splitIntents(apiKey: string | undefined, endpointUrl: string | undefined, input: SplitIntentsInput): Promise<import("../orchestrator").SplitIntentsResult>;
|
|
39
|
+
export { sendTransaction, sendTransactionInternal, sendUserOperation, sendUserOperationInternal, waitForExecution, getPortfolio, getIntentStatus, splitIntents, isExecutionError, ExecutionError, IntentFailedError, IntentStatusTimeoutError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SignerNotSupportedError, };
|
|
40
|
+
export type { TransactionStatus, TransactionResult, UserOperationResult };
|
|
41
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../execution/index.ts"],"names":[],"mappings":"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"}
|