@charterlabs/rhinestone-sdk 0.2.8 → 0.2.9
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 +4 -1
- package/dist/src/accounts/error.d.ts.map +1 -1
- package/dist/src/accounts/error.js +9 -1
- package/dist/src/accounts/index.d.ts +9 -2
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +26 -1
- package/dist/src/accounts/json-rpc/index.d.ts.map +1 -1
- package/dist/src/accounts/json-rpc/index.js +4 -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 +2 -1
- package/dist/src/accounts/json-rpc/providers.d.ts.map +1 -1
- package/dist/src/accounts/json-rpc/providers.js +8 -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 +9 -2
- package/dist/src/accounts/kernel.d.ts.map +1 -1
- package/dist/src/accounts/kernel.js +13 -0
- package/dist/src/accounts/nexus.d.ts +9 -2
- package/dist/src/accounts/nexus.d.ts.map +1 -1
- package/dist/src/accounts/nexus.js +15 -1
- package/dist/src/accounts/passport.d.ts +4 -4
- package/dist/src/accounts/passport.d.ts.map +1 -1
- package/dist/src/accounts/safe.d.ts +9 -2
- package/dist/src/accounts/safe.d.ts.map +1 -1
- package/dist/src/accounts/safe.js +15 -0
- package/dist/src/accounts/signing/common.d.ts.map +1 -1
- package/dist/src/accounts/signing/common.js +26 -5
- package/dist/src/accounts/signing/message.js +1 -1
- package/dist/src/accounts/startale.d.ts +9 -2
- package/dist/src/accounts/startale.d.ts.map +1 -1
- package/dist/src/accounts/startale.js +15 -0
- package/dist/src/accounts/walletClient.d.ts +27 -0
- package/dist/src/accounts/walletClient.d.ts.map +1 -1
- package/dist/src/accounts/walletClient.js +77 -0
- package/dist/src/actions/smart-sessions.d.ts +2 -11
- package/dist/src/actions/smart-sessions.d.ts.map +1 -1
- package/dist/src/actions/smart-sessions.js +0 -10
- package/dist/src/errors/index.d.ts +3 -3
- package/dist/src/errors/index.d.ts.map +1 -1
- package/dist/src/errors/index.js +3 -1
- package/dist/src/execution/index.d.ts +8 -3
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +27 -7
- package/dist/src/execution/singleChainOps.d.ts +28 -0
- package/dist/src/execution/singleChainOps.d.ts.map +1 -0
- package/dist/src/execution/{multiChainOps.js → singleChainOps.js} +7 -14
- package/dist/src/execution/smart-session.d.ts +5 -7
- package/dist/src/execution/smart-session.d.ts.map +1 -1
- package/dist/src/execution/smart-session.js +113 -228
- package/dist/src/execution/utils.d.ts +2 -2
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +81 -22
- package/dist/src/index.d.ts +14 -16
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +15 -6
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +1 -1
- 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 +39 -2
- package/dist/src/modules/validators/smart-sessions.d.ts +6 -6
- package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -1
- package/dist/src/modules/validators/smart-sessions.js +23 -12
- package/dist/src/orchestrator/client.d.ts.map +1 -1
- package/dist/src/orchestrator/client.js +13 -1
- package/dist/src/orchestrator/error.d.ts +27 -1
- package/dist/src/orchestrator/error.d.ts.map +1 -1
- package/dist/src/orchestrator/error.js +10 -1
- package/dist/src/orchestrator/index.d.ts +6 -6
- package/dist/src/orchestrator/index.d.ts.map +1 -1
- package/dist/src/orchestrator/index.js +4 -3
- package/dist/src/orchestrator/registry.d.ts +6 -2
- package/dist/src/orchestrator/registry.d.ts.map +1 -1
- package/dist/src/orchestrator/registry.js +16 -64
- package/dist/src/orchestrator/registry.test.js +24 -24
- package/dist/src/orchestrator/types.d.ts +37 -23
- package/dist/src/orchestrator/types.d.ts.map +1 -1
- package/dist/src/orchestrator/types.js +9 -5
- package/dist/src/types.d.ts +30 -7
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/src/execution/multiChainOps.d.ts +0 -40
- package/dist/src/execution/multiChainOps.d.ts.map +0 -1
- package/dist/src/execution/smart-session.test.d.ts +0 -2
- package/dist/src/execution/smart-session.test.d.ts.map +0 -1
- package/dist/src/execution/smart-session.test.js +0 -34
|
@@ -14,7 +14,7 @@ async function sign(signers, chain, address, hash, isUserOpHash) {
|
|
|
14
14
|
return (0, common_1.signWithOwners)(signers, chain, address, hash, signingFunctions, isUserOpHash, sign);
|
|
15
15
|
}
|
|
16
16
|
case 'session': {
|
|
17
|
-
return (0, common_1.signWithSession)(signers, chain, address, hash,
|
|
17
|
+
return (0, common_1.signWithSession)(signers, chain, address, hash, false, sign);
|
|
18
18
|
}
|
|
19
19
|
case 'guardians': {
|
|
20
20
|
return (0, common_1.signWithGuardians)(signers, hash, signingFunctions);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Address, Hex, PublicClient } from 'viem';
|
|
1
|
+
import type { Address, Chain, Hex, PublicClient } from 'viem';
|
|
2
2
|
import type { Module } from '../modules/common';
|
|
3
3
|
import type { EnableSessionData } from '../modules/validators/smart-sessions';
|
|
4
4
|
import type { OwnerSet, RhinestoneAccountConfig, Session } from '../types';
|
|
@@ -11,10 +11,17 @@ declare function getDeployArgs(config: RhinestoneAccountConfig): {
|
|
|
11
11
|
initializationCallData: `0x${string}`;
|
|
12
12
|
};
|
|
13
13
|
declare function getAddress(config: RhinestoneAccountConfig): `0x${string}`;
|
|
14
|
+
declare function getEip712Domain(config: RhinestoneAccountConfig, chain: Chain): {
|
|
15
|
+
name: string;
|
|
16
|
+
version: string;
|
|
17
|
+
chainId: number;
|
|
18
|
+
verifyingContract: `0x${string}`;
|
|
19
|
+
salt: "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
20
|
+
};
|
|
14
21
|
declare function getInstallData(module: Module): `0x${string}`;
|
|
15
22
|
declare function packSignature(signature: Hex, validator: ValidatorConfig, transformSignature?: (signature: Hex) => Hex): Promise<`0x${string}`>;
|
|
16
23
|
declare function getSmartAccount(client: PublicClient, address: Address, owners: OwnerSet, validatorAddress: Address, sign: (hash: Hex) => Promise<Hex>): Promise<import("viem/_types/account-abstraction").SmartAccount<import("viem/_types/account-abstraction").SmartAccountImplementation<import("viem").Abi, "0.7">>>;
|
|
17
24
|
declare function getSessionSmartAccount(client: PublicClient, address: Address, session: Session, validatorAddress: Address, enableData: EnableSessionData | null, sign: (hash: Hex) => Promise<Hex>): Promise<import("viem/_types/account-abstraction").SmartAccount<import("viem/_types/account-abstraction").SmartAccountImplementation<import("viem").Abi, "0.7">>>;
|
|
18
25
|
declare function getGuardianSmartAccount(client: PublicClient, address: Address, guardians: OwnerSet, validatorAddress: Address, sign: (hash: Hex) => Promise<Hex>): Promise<import("viem/_types/account-abstraction").SmartAccount<import("viem/_types/account-abstraction").SmartAccountImplementation<import("viem").Abi, "0.7">>>;
|
|
19
|
-
export { getInstallData, getAddress, packSignature, getDeployArgs, getSmartAccount, getSessionSmartAccount, getGuardianSmartAccount, };
|
|
26
|
+
export { getEip712Domain, getInstallData, getAddress, packSignature, getDeployArgs, getSmartAccount, getSessionSmartAccount, getGuardianSmartAccount, };
|
|
20
27
|
//# sourceMappingURL=startale.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"startale.d.ts","sourceRoot":"","sources":["../../../accounts/startale.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"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BAAuB,CACpC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,QAAQ,EACnB,gBAAgB,EAAE,OAAO,EACzB,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,oKAUlC;AAED,OAAO,EACL,eAAe,EACf,cAAc,EACd,UAAU,EACV,aAAa,EACb,aAAa,EACb,eAAe,EACf,sBAAsB,EACtB,uBAAuB,GACxB,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getEip712Domain = getEip712Domain;
|
|
3
4
|
exports.getInstallData = getInstallData;
|
|
4
5
|
exports.getAddress = getAddress;
|
|
5
6
|
exports.packSignature = packSignature;
|
|
@@ -9,8 +10,10 @@ exports.getSessionSmartAccount = getSessionSmartAccount;
|
|
|
9
10
|
exports.getGuardianSmartAccount = getGuardianSmartAccount;
|
|
10
11
|
const viem_1 = require("viem");
|
|
11
12
|
const modules_1 = require("../modules");
|
|
13
|
+
const error_1 = require("./error");
|
|
12
14
|
const nexus_1 = require("./nexus");
|
|
13
15
|
const K1_DEFAULT_VALIDATOR_ADDRESS = '0x00000072f286204bb934ed49d8969e86f7dec7b1';
|
|
16
|
+
const STARTALE_VERSION = '1.0.0';
|
|
14
17
|
const IMPLEMENTATION_ADDRESS = '0x000000b8f5f723a680d3d7ee624fe0bc84a6e05a';
|
|
15
18
|
const FACTORY_ADDRESS = '0x0000003B3E7b530b4f981aE80d9350392Defef90';
|
|
16
19
|
const BOOTSTRAP_ADDRESS = '0x000000552A5fAe3Db7a8F3917C435448F49BA6a9';
|
|
@@ -83,6 +86,18 @@ function getAddress(config) {
|
|
|
83
86
|
const address = (0, viem_1.slice)(hash, 12, 32);
|
|
84
87
|
return address;
|
|
85
88
|
}
|
|
89
|
+
function getEip712Domain(config, chain) {
|
|
90
|
+
if (config.initData) {
|
|
91
|
+
throw new error_1.Eip712DomainNotAvailableError('Existing Startale accounts are not yet supported');
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
name: 'Startale',
|
|
95
|
+
version: STARTALE_VERSION,
|
|
96
|
+
chainId: chain.id,
|
|
97
|
+
verifyingContract: getAddress(config),
|
|
98
|
+
salt: viem_1.zeroHash,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
86
101
|
function getInstallData(module) {
|
|
87
102
|
return (0, nexus_1.getInstallData)(module);
|
|
88
103
|
}
|
|
@@ -4,4 +4,31 @@ import type { Account, WalletClient } from 'viem';
|
|
|
4
4
|
* Ensures address is set and routes sign methods through the provided client.
|
|
5
5
|
*/
|
|
6
6
|
export declare function walletClientToAccount(walletClient: WalletClient): Account;
|
|
7
|
+
/**
|
|
8
|
+
* Wraps a Para viem account with custom signing for Rhinestone compatibility.
|
|
9
|
+
*
|
|
10
|
+
* Para's MPC signatures use 0/1 v-byte recovery, but Rhinestone/Smart wallets
|
|
11
|
+
* expect 27/28 v-byte recovery. This wrapper adjusts Para signatures automatically.
|
|
12
|
+
*
|
|
13
|
+
* @param viemAccount - The Para viem account to wrap
|
|
14
|
+
* @param walletId - Optional wallet ID for Para signing operations
|
|
15
|
+
* @returns Account compatible with Rhinestone SDK
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* const paraAccount = // ... Para viem account
|
|
20
|
+
* const wrappedAccount = wrapParaAccount(paraAccount, wallet.id)
|
|
21
|
+
*
|
|
22
|
+
* const rhinestoneAccount = await rhinestone.createAccount({
|
|
23
|
+
* owners: {
|
|
24
|
+
* type: "ecdsa",
|
|
25
|
+
* accounts: [wrappedAccount],
|
|
26
|
+
* },
|
|
27
|
+
* })
|
|
28
|
+
*
|
|
29
|
+
* // Also works for EIP-7702 (signAuthorization uses original 0/1 v-byte)
|
|
30
|
+
* const authorization = await wrappedAccount.signAuthorization?.({ ... })
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function wrapParaAccount(viemAccount: Account, walletId?: string): Account;
|
|
7
34
|
//# sourceMappingURL=walletClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walletClient.d.ts","sourceRoot":"","sources":["../../../accounts/walletClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,
|
|
1
|
+
{"version":3,"file":"walletClient.d.ts","sourceRoot":"","sources":["../../../accounts/walletClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EAOP,YAAY,EACb,MAAM,MAAM,CAAA;AAGb;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CA2CzE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,eAAe,CAC7B,WAAW,EAAE,OAAO,EACpB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAsCT"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.walletClientToAccount = walletClientToAccount;
|
|
4
|
+
exports.wrapParaAccount = wrapParaAccount;
|
|
4
5
|
const error_1 = require("./error");
|
|
5
6
|
/**
|
|
6
7
|
* Adapts a Viem/Wagmi WalletClient into an Account-like signer that the SDK can consume.
|
|
@@ -36,3 +37,79 @@ function walletClientToAccount(walletClient) {
|
|
|
36
37
|
};
|
|
37
38
|
return account;
|
|
38
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Wraps a Para viem account with custom signing for Rhinestone compatibility.
|
|
42
|
+
*
|
|
43
|
+
* Para's MPC signatures use 0/1 v-byte recovery, but Rhinestone/Smart wallets
|
|
44
|
+
* expect 27/28 v-byte recovery. This wrapper adjusts Para signatures automatically.
|
|
45
|
+
*
|
|
46
|
+
* @param viemAccount - The Para viem account to wrap
|
|
47
|
+
* @param walletId - Optional wallet ID for Para signing operations
|
|
48
|
+
* @returns Account compatible with Rhinestone SDK
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* const paraAccount = // ... Para viem account
|
|
53
|
+
* const wrappedAccount = wrapParaAccount(paraAccount, wallet.id)
|
|
54
|
+
*
|
|
55
|
+
* const rhinestoneAccount = await rhinestone.createAccount({
|
|
56
|
+
* owners: {
|
|
57
|
+
* type: "ecdsa",
|
|
58
|
+
* accounts: [wrappedAccount],
|
|
59
|
+
* },
|
|
60
|
+
* })
|
|
61
|
+
*
|
|
62
|
+
* // Also works for EIP-7702 (signAuthorization uses original 0/1 v-byte)
|
|
63
|
+
* const authorization = await wrappedAccount.signAuthorization?.({ ... })
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
function wrapParaAccount(viemAccount, walletId) {
|
|
67
|
+
// Store the wallet ID for signing operations (for debugging purposes)
|
|
68
|
+
const effectiveWalletId = walletId || viemAccount.walletId || viemAccount._walletId;
|
|
69
|
+
// Store reference for potential debugging
|
|
70
|
+
if (effectiveWalletId) {
|
|
71
|
+
;
|
|
72
|
+
viemAccount._paraWalletId = effectiveWalletId;
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
...viemAccount,
|
|
76
|
+
// Override signMessage to adjust v-byte for smart wallet compatibility
|
|
77
|
+
signMessage: async ({ message }) => {
|
|
78
|
+
if (!viemAccount.signMessage) {
|
|
79
|
+
throw new Error('Account does not support signMessage');
|
|
80
|
+
}
|
|
81
|
+
const originalSignature = await viemAccount.signMessage({ message });
|
|
82
|
+
return adjustVByte(originalSignature);
|
|
83
|
+
},
|
|
84
|
+
// Override signTypedData to adjust v-byte for smart wallet compatibility
|
|
85
|
+
signTypedData: async (typedData) => {
|
|
86
|
+
if (!viemAccount.signTypedData) {
|
|
87
|
+
throw new Error('Account does not support signTypedData');
|
|
88
|
+
}
|
|
89
|
+
const originalSignature = await viemAccount.signTypedData(typedData);
|
|
90
|
+
return adjustVByte(originalSignature);
|
|
91
|
+
},
|
|
92
|
+
// Keep signAuthorization as is for EIP-7702
|
|
93
|
+
signAuthorization: viemAccount.signAuthorization
|
|
94
|
+
? viemAccount.signAuthorization.bind(viemAccount)
|
|
95
|
+
: undefined,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Adjusts the v-byte in a signature from Para's 0/1 format to Ethereum's 27/28 format.
|
|
100
|
+
* @internal
|
|
101
|
+
*/
|
|
102
|
+
function adjustVByte(signature) {
|
|
103
|
+
const V_OFFSET_FOR_ETHEREUM = 27;
|
|
104
|
+
const cleanSig = signature.startsWith('0x') ? signature.slice(2) : signature;
|
|
105
|
+
const r = cleanSig.slice(0, 64);
|
|
106
|
+
const s = cleanSig.slice(64, 128);
|
|
107
|
+
let v = parseInt(cleanSig.slice(128, 130), 16);
|
|
108
|
+
if (v < 27) {
|
|
109
|
+
v += V_OFFSET_FOR_ETHEREUM;
|
|
110
|
+
}
|
|
111
|
+
const adjustedSignature = `0x${r}${s}${v
|
|
112
|
+
.toString(16)
|
|
113
|
+
.padStart(2, '0')}`;
|
|
114
|
+
return adjustedSignature;
|
|
115
|
+
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { SessionDetails } from '../execution/smart-session';
|
|
3
|
-
import { Session } from '../types';
|
|
1
|
+
import type { Session } from '../types';
|
|
4
2
|
/**
|
|
5
3
|
* Enable a smart session
|
|
6
4
|
* @param session session to enable
|
|
@@ -12,12 +10,5 @@ declare function enableSession(session: Session): {
|
|
|
12
10
|
data: `0x${string}`;
|
|
13
11
|
}>;
|
|
14
12
|
};
|
|
15
|
-
|
|
16
|
-
* Encode a smart session signature
|
|
17
|
-
* @param sessionDetails Session details
|
|
18
|
-
* @param sessionSignature Session signature
|
|
19
|
-
* @returns Encoded smart session signature
|
|
20
|
-
*/
|
|
21
|
-
declare function encodeSmartSessionSignature(sessionDetails: SessionDetails, sessionSignature: Hex): `0x${string}`;
|
|
22
|
-
export { enableSession, encodeSmartSessionSignature };
|
|
13
|
+
export { enableSession };
|
|
23
14
|
//# sourceMappingURL=smart-sessions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smart-sessions.d.ts","sourceRoot":"","sources":["../../../actions/smart-sessions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"smart-sessions.d.ts","sourceRoot":"","sources":["../../../actions/smart-sessions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAEvC;;;;GAIG;AACH,iBAAS,aAAa,CAAC,OAAO,EAAE,OAAO;;;;;EAMtC;AAED,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.enableSession = enableSession;
|
|
4
|
-
exports.encodeSmartSessionSignature = encodeSmartSessionSignature;
|
|
5
4
|
const smart_sessions_1 = require("../modules/validators/smart-sessions");
|
|
6
5
|
/**
|
|
7
6
|
* Enable a smart session
|
|
@@ -15,12 +14,3 @@ function enableSession(session) {
|
|
|
15
14
|
},
|
|
16
15
|
};
|
|
17
16
|
}
|
|
18
|
-
/**
|
|
19
|
-
* Encode a smart session signature
|
|
20
|
-
* @param sessionDetails Session details
|
|
21
|
-
* @param sessionSignature Session signature
|
|
22
|
-
* @returns Encoded smart session signature
|
|
23
|
-
*/
|
|
24
|
-
function encodeSmartSessionSignature(sessionDetails, sessionSignature) {
|
|
25
|
-
return (0, smart_sessions_1.encodeSmartSessionSignature)(sessionDetails.mode, sessionDetails.enableSessionData.permissionId, sessionSignature, sessionDetails.enableSessionData);
|
|
26
|
-
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AccountConfigurationNotSupportedError, AccountError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, isAccountError, SigningNotSupportedForAccountError, SmartSessionsNotEnabledError, WalletClientNoConnectedAccountError } from '../accounts';
|
|
1
|
+
import { AccountConfigurationNotSupportedError, AccountError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, isAccountError, SigningNotSupportedForAccountError, SmartSessionsNotEnabledError, WalletClientNoConnectedAccountError } from '../accounts';
|
|
2
2
|
import { ExecutionError, IntentFailedError, isExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SignerNotSupportedError } from '../execution';
|
|
3
|
-
import { AuthenticationRequiredError, BadRequestError, BodyParserError, ConflictError, ForbiddenError, InsufficientBalanceError, IntentNotFoundError, InternalServerError, InvalidApiKeyError, InvalidIntentSignatureError, isAuthError, isOrchestratorError, isRateLimited, isRetryable, isValidationError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, RateLimitedError, ResourceNotFoundError, SchemaValidationError, ServiceUnavailableError, TokenNotSupportedError, UnauthorizedError, UnprocessableEntityError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError } from '../orchestrator';
|
|
4
|
-
export { isAccountError, AccountError, AccountConfigurationNotSupportedError, Eip7702AccountMustHaveEoaError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, SmartSessionsNotEnabledError, SigningNotSupportedForAccountError, Eip7702NotSupportedForAccountError, WalletClientNoConnectedAccountError, isExecutionError, ExecutionError, IntentFailedError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SignerNotSupportedError, isOrchestratorError, isRetryable, isAuthError, isValidationError, isRateLimited, AuthenticationRequiredError, BadRequestError, BodyParserError, ConflictError, ForbiddenError, InsufficientBalanceError, InvalidApiKeyError, InvalidIntentSignatureError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, IntentNotFoundError, InternalServerError, ResourceNotFoundError, RateLimitedError, SchemaValidationError, ServiceUnavailableError, UnprocessableEntityError, UnauthorizedError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError, };
|
|
3
|
+
import { AuthenticationRequiredError, BadRequestError, BodyParserError, ConflictError, ForbiddenError, InsufficientBalanceError, IntentNotFoundError, InternalServerError, InvalidApiKeyError, InvalidIntentSignatureError, isAuthError, isOrchestratorError, isRateLimited, isRetryable, isValidationError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, RateLimitedError, ResourceNotFoundError, SchemaValidationError, ServiceUnavailableError, SimulationFailedError, TokenNotSupportedError, UnauthorizedError, UnprocessableEntityError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError } from '../orchestrator';
|
|
4
|
+
export { isAccountError, AccountError, AccountConfigurationNotSupportedError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, SmartSessionsNotEnabledError, SigningNotSupportedForAccountError, Eip7702NotSupportedForAccountError, WalletClientNoConnectedAccountError, isExecutionError, ExecutionError, IntentFailedError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SignerNotSupportedError, isOrchestratorError, isRetryable, isAuthError, isValidationError, isRateLimited, AuthenticationRequiredError, BadRequestError, BodyParserError, ConflictError, ForbiddenError, InsufficientBalanceError, InvalidApiKeyError, InvalidIntentSignatureError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, IntentNotFoundError, InternalServerError, ResourceNotFoundError, RateLimitedError, SchemaValidationError, ServiceUnavailableError, SimulationFailedError, UnprocessableEntityError, UnauthorizedError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError, };
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL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EACvB,wBAAwB,EACxB,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,GACtB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qCAAqC,EACrC,YAAY,EACZ,6BAA6B,EAC7B,8BAA8B,EAC9B,kCAAkC,EAClC,wCAAwC,EACxC,4BAA4B,EAC5B,cAAc,EACd,kCAAkC,EAClC,4BAA4B,EAC5B,mCAAmC,EACpC,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,gCAAgC,EAChC,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,2BAA2B,EAC3B,eAAe,EACf,eAAe,EACf,aAAa,EACb,cAAc,EACd,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,2BAA2B,EAC3B,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,uCAAuC,EACvC,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,iBAAiB,CAAA;AAExB,OAAO,EAEL,cAAc,EACd,YAAY,EACZ,qCAAqC,EACrC,6BAA6B,EAC7B,8BAA8B,EAC9B,wCAAwC,EACxC,4BAA4B,EAC5B,4BAA4B,EAC5B,kCAAkC,EAClC,kCAAkC,EAClC,mCAAmC,EAEnC,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,gCAAgC,EAChC,yBAAyB,EACzB,uBAAuB,EAEvB,mBAAmB,EACnB,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,2BAA2B,EAC3B,eAAe,EACf,eAAe,EACf,aAAa,EACb,cAAc,EACd,wBAAwB,EACxB,kBAAkB,EAClB,2BAA2B,EAC3B,gBAAgB,EAChB,uCAAuC,EACvC,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EACxB,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,GACtB,CAAA"}
|
package/dist/src/errors/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UnsupportedTokenError = exports.UnsupportedChainIdError = exports.UnsupportedChainError = exports.TokenNotSupportedError = exports.UnauthorizedError = exports.UnprocessableEntityError = exports.ServiceUnavailableError = exports.SchemaValidationError = exports.RateLimitedError = exports.ResourceNotFoundError = exports.InternalServerError = exports.IntentNotFoundError = exports.OrchestratorError = exports.OnlyOneTargetTokenAmountCanBeUnsetError = exports.NoPathFoundError = exports.InvalidIntentSignatureError = exports.InvalidApiKeyError = exports.InsufficientBalanceError = exports.ForbiddenError = exports.ConflictError = exports.BodyParserError = exports.BadRequestError = exports.AuthenticationRequiredError = exports.isRateLimited = exports.isValidationError = exports.isAuthError = exports.isRetryable = exports.isOrchestratorError = exports.SignerNotSupportedError = exports.SessionChainRequiredError = exports.OrderPathRequiredForIntentsError = exports.IntentFailedError = exports.ExecutionError = exports.isExecutionError = exports.WalletClientNoConnectedAccountError = exports.Eip7702NotSupportedForAccountError = exports.SigningNotSupportedForAccountError = exports.SmartSessionsNotEnabledError = exports.FactoryArgsNotAvailableError = exports.ExistingEip7702AccountsNotSupportedError = exports.Eip7702AccountMustHaveEoaError = exports.AccountConfigurationNotSupportedError = exports.AccountError = exports.isAccountError = void 0;
|
|
3
|
+
exports.UnsupportedTokenError = exports.UnsupportedChainIdError = exports.UnsupportedChainError = exports.TokenNotSupportedError = exports.UnauthorizedError = exports.UnprocessableEntityError = exports.SimulationFailedError = exports.ServiceUnavailableError = exports.SchemaValidationError = exports.RateLimitedError = exports.ResourceNotFoundError = exports.InternalServerError = exports.IntentNotFoundError = exports.OrchestratorError = exports.OnlyOneTargetTokenAmountCanBeUnsetError = exports.NoPathFoundError = exports.InvalidIntentSignatureError = exports.InvalidApiKeyError = exports.InsufficientBalanceError = exports.ForbiddenError = exports.ConflictError = exports.BodyParserError = exports.BadRequestError = exports.AuthenticationRequiredError = exports.isRateLimited = exports.isValidationError = exports.isAuthError = exports.isRetryable = exports.isOrchestratorError = exports.SignerNotSupportedError = exports.SessionChainRequiredError = exports.OrderPathRequiredForIntentsError = exports.IntentFailedError = exports.ExecutionError = exports.isExecutionError = exports.WalletClientNoConnectedAccountError = exports.Eip7702NotSupportedForAccountError = exports.SigningNotSupportedForAccountError = exports.SmartSessionsNotEnabledError = exports.FactoryArgsNotAvailableError = exports.ExistingEip7702AccountsNotSupportedError = exports.Eip7702AccountMustHaveEoaError = exports.Eip712DomainNotAvailableError = exports.AccountConfigurationNotSupportedError = exports.AccountError = exports.isAccountError = void 0;
|
|
4
4
|
const accounts_1 = require("../accounts");
|
|
5
5
|
Object.defineProperty(exports, "AccountConfigurationNotSupportedError", { enumerable: true, get: function () { return accounts_1.AccountConfigurationNotSupportedError; } });
|
|
6
6
|
Object.defineProperty(exports, "AccountError", { enumerable: true, get: function () { return accounts_1.AccountError; } });
|
|
7
|
+
Object.defineProperty(exports, "Eip712DomainNotAvailableError", { enumerable: true, get: function () { return accounts_1.Eip712DomainNotAvailableError; } });
|
|
7
8
|
Object.defineProperty(exports, "Eip7702AccountMustHaveEoaError", { enumerable: true, get: function () { return accounts_1.Eip7702AccountMustHaveEoaError; } });
|
|
8
9
|
Object.defineProperty(exports, "Eip7702NotSupportedForAccountError", { enumerable: true, get: function () { return accounts_1.Eip7702NotSupportedForAccountError; } });
|
|
9
10
|
Object.defineProperty(exports, "ExistingEip7702AccountsNotSupportedError", { enumerable: true, get: function () { return accounts_1.ExistingEip7702AccountsNotSupportedError; } });
|
|
@@ -42,6 +43,7 @@ Object.defineProperty(exports, "RateLimitedError", { enumerable: true, get: func
|
|
|
42
43
|
Object.defineProperty(exports, "ResourceNotFoundError", { enumerable: true, get: function () { return orchestrator_1.ResourceNotFoundError; } });
|
|
43
44
|
Object.defineProperty(exports, "SchemaValidationError", { enumerable: true, get: function () { return orchestrator_1.SchemaValidationError; } });
|
|
44
45
|
Object.defineProperty(exports, "ServiceUnavailableError", { enumerable: true, get: function () { return orchestrator_1.ServiceUnavailableError; } });
|
|
46
|
+
Object.defineProperty(exports, "SimulationFailedError", { enumerable: true, get: function () { return orchestrator_1.SimulationFailedError; } });
|
|
45
47
|
Object.defineProperty(exports, "TokenNotSupportedError", { enumerable: true, get: function () { return orchestrator_1.TokenNotSupportedError; } });
|
|
46
48
|
Object.defineProperty(exports, "UnauthorizedError", { enumerable: true, get: function () { return orchestrator_1.UnauthorizedError; } });
|
|
47
49
|
Object.defineProperty(exports, "UnprocessableEntityError", { enumerable: true, get: function () { return orchestrator_1.UnprocessableEntityError; } });
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Address, type Chain, type Hex } from 'viem';
|
|
2
2
|
import type { UserOperationReceipt } from 'viem/_types/account-abstraction';
|
|
3
|
-
import type {
|
|
3
|
+
import type { IntentOpStatus } from '../orchestrator';
|
|
4
|
+
import type { Account, SettlementLayer } from '../orchestrator/types';
|
|
4
5
|
import type { CalldataInput, CallInput, RhinestoneAccountConfig, RhinestoneConfig, SignerSet, SourceAssetInput, TokenRequest, TokenSymbol, Transaction, UserOperationTransaction } from '../types';
|
|
5
6
|
import { ExecutionError, IntentFailedError, IntentStatusTimeoutError, isExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SignerNotSupportedError } from './error';
|
|
6
7
|
import type { TransactionResult, UserOperationResult } from './utils';
|
|
@@ -19,6 +20,7 @@ declare function sendUserOperation(config: RhinestoneAccountConfig, transaction:
|
|
|
19
20
|
declare function sendTransactionInternal(config: RhinestoneConfig, sourceChains: Chain[], targetChain: Chain, callInputs: CallInput[], options: {
|
|
20
21
|
gasLimit?: bigint;
|
|
21
22
|
initialTokenRequests?: TokenRequest[];
|
|
23
|
+
recipient?: Account;
|
|
22
24
|
signers?: SignerSet;
|
|
23
25
|
sponsored?: boolean;
|
|
24
26
|
settlementLayers?: SettlementLayer[];
|
|
@@ -29,8 +31,11 @@ declare function sendTransactionInternal(config: RhinestoneConfig, sourceChains:
|
|
|
29
31
|
}): Promise<TransactionResult>;
|
|
30
32
|
declare function sendUserOperationInternal(config: RhinestoneConfig, chain: Chain, callInputs: CalldataInput[], signers?: SignerSet): Promise<UserOperationResult>;
|
|
31
33
|
declare function waitForExecution(config: RhinestoneConfig, result: TransactionResult | UserOperationResult, acceptsPreconfirmations: boolean): Promise<TransactionStatus | UserOperationReceipt>;
|
|
32
|
-
declare function getMaxSpendableAmount(config: RhinestoneConfig, chain: Chain,
|
|
34
|
+
declare function getMaxSpendableAmount(config: RhinestoneConfig, chain: Chain, token: Address | TokenSymbol, gasUnits: bigint, sponsored?: boolean): Promise<bigint>;
|
|
33
35
|
declare function getPortfolio(config: RhinestoneConfig, onTestnets: boolean): Promise<import("../orchestrator").Portfolio>;
|
|
34
|
-
|
|
36
|
+
declare function getIntentStatus(apiKey: string | undefined, endpointUrl: string | undefined, intentId: bigint): Promise<TransactionStatus & {
|
|
37
|
+
status: IntentOpStatus['status'];
|
|
38
|
+
}>;
|
|
39
|
+
export { sendTransaction, sendTransactionInternal, sendUserOperation, sendUserOperationInternal, waitForExecution, getMaxSpendableAmount, getPortfolio, getIntentStatus, isExecutionError, ExecutionError, IntentFailedError, IntentStatusTimeoutError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SignerNotSupportedError, };
|
|
35
40
|
export type { TransactionStatus, TransactionResult, UserOperationResult };
|
|
36
41
|
//# 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,OAAO,EAAE,KAAK,KAAK,EAAsB,KAAK,GAAG,EAAE,MAAM,MAAM,CAAA;AAC7E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../execution/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAAsB,KAAK,GAAG,EAAE,MAAM,MAAM,CAAA;AAC7E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAA;AAI3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAUrD,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACrE,OAAO,KAAK,EACV,aAAa,EACb,SAAS,EACT,uBAAuB,EACvB,gBAAgB,EAChB,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,WAAW,EACX,wBAAwB,EACzB,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,wBAAwB,EACxB,gBAAgB,EAChB,gCAAgC,EAChC,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAoBrE,UAAU,iBAAiB;IACzB,IAAI,EAAE;QACJ,IAAI,EAAE,GAAG,GAAG,SAAS,CAAA;QACrB,OAAO,EAAE,MAAM,CAAA;KAChB,CAAA;IACD,MAAM,EAAE;QACN,IAAI,EAAE,GAAG,GAAG,SAAS,CAAA;QACrB,OAAO,EAAE,MAAM,CAAA;KAChB,EAAE,CA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,CAAC,CAejB;AAED,iBAAe,YAAY,CAAC,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,OAAO,gDASxE;AAED,iBAAe,eAAe,CAC5B,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,QAAQ,EAAE,MAAM,GACf,OAAO,CACR,iBAAiB,GAAG;IAClB,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAA;CACjC,CACF,CAgBA;AAED,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,iBAAiB,EACjB,yBAAyB,EACzB,gBAAgB,EAChB,qBAAqB,EACrB,YAAY,EACZ,eAAe,EAEf,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,wBAAwB,EACxB,gCAAgC,EAChC,yBAAyB,EACzB,uBAAuB,GACxB,CAAA;AACD,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -8,6 +8,7 @@ exports.sendUserOperationInternal = sendUserOperationInternal;
|
|
|
8
8
|
exports.waitForExecution = waitForExecution;
|
|
9
9
|
exports.getMaxSpendableAmount = getMaxSpendableAmount;
|
|
10
10
|
exports.getPortfolio = getPortfolio;
|
|
11
|
+
exports.getIntentStatus = getIntentStatus;
|
|
11
12
|
const viem_1 = require("viem");
|
|
12
13
|
const chains_1 = require("viem/chains");
|
|
13
14
|
const accounts_1 = require("../accounts");
|
|
@@ -25,7 +26,7 @@ Object.defineProperty(exports, "SignerNotSupportedError", { enumerable: true, ge
|
|
|
25
26
|
const smart_session_1 = require("./smart-session");
|
|
26
27
|
const utils_2 = require("./utils");
|
|
27
28
|
const POLL_INITIAL_MS = 500;
|
|
28
|
-
const POLL_SLOW_AFTER_MS =
|
|
29
|
+
const POLL_SLOW_AFTER_MS = 15000;
|
|
29
30
|
const POLL_SLOW_MS = 2000;
|
|
30
31
|
const POLL_MAX_WAIT_MS = 180000;
|
|
31
32
|
const POLL_ERROR_BACKOFF_MS = 1000;
|
|
@@ -35,7 +36,7 @@ async function sendTransaction(config, transaction) {
|
|
|
35
36
|
? [transaction.chain]
|
|
36
37
|
: transaction.sourceChains || [];
|
|
37
38
|
const targetChain = 'chain' in transaction ? transaction.chain : transaction.targetChain;
|
|
38
|
-
const { calls, gasLimit, tokenRequests, signers, sponsored, settlementLayers, sourceAssets, feeAsset, dryRun, } = transaction;
|
|
39
|
+
const { calls, gasLimit, tokenRequests, recipient, signers, sponsored, settlementLayers, sourceAssets, feeAsset, dryRun, } = transaction;
|
|
39
40
|
const isUserOpSigner = signers?.type === 'guardians' || signers?.type === 'session';
|
|
40
41
|
if (isUserOpSigner) {
|
|
41
42
|
throw new error_1.SignerNotSupportedError();
|
|
@@ -43,6 +44,7 @@ async function sendTransaction(config, transaction) {
|
|
|
43
44
|
return await sendTransactionInternal(config, sourceChains, targetChain, calls, {
|
|
44
45
|
gasLimit,
|
|
45
46
|
initialTokenRequests: tokenRequests,
|
|
47
|
+
recipient,
|
|
46
48
|
signers,
|
|
47
49
|
sponsored,
|
|
48
50
|
settlementLayers,
|
|
@@ -70,7 +72,7 @@ async function sendTransactionInternal(config, sourceChains, targetChain, callIn
|
|
|
70
72
|
throw new error_1.SignerNotSupportedError();
|
|
71
73
|
}
|
|
72
74
|
else {
|
|
73
|
-
return await sendTransactionAsIntent(config, sourceChains, targetChain, resolvedCalls, options.gasLimit, tokenRequests, accountAddress, options.dryRun, options.signers, options.sponsored, options.settlementLayers, options.sourceAssets, options.feeAsset, options.lockFunds);
|
|
75
|
+
return await sendTransactionAsIntent(config, sourceChains, targetChain, resolvedCalls, options.gasLimit, tokenRequests, options.recipient, accountAddress, options.dryRun, options.signers, options.sponsored, options.settlementLayers, options.sourceAssets, options.feeAsset, options.lockFunds);
|
|
74
76
|
}
|
|
75
77
|
}
|
|
76
78
|
async function sendUserOperationInternal(config, chain, callInputs, signers) {
|
|
@@ -100,8 +102,8 @@ async function sendUserOperationInternal(config, chain, callInputs, signers) {
|
|
|
100
102
|
chain: chain.id,
|
|
101
103
|
};
|
|
102
104
|
}
|
|
103
|
-
async function sendTransactionAsIntent(config, sourceChains, targetChain, callInputs, gasLimit, tokenRequests, accountAddress, dryRun = false, signers, sponsored, settlementLayers, sourceAssets, feeAsset, lockFunds) {
|
|
104
|
-
const intentRoute = await (0, utils_2.prepareTransactionAsIntent)(config, sourceChains, targetChain, callInputs, gasLimit, tokenRequests, accountAddress, sponsored ?? false, undefined, settlementLayers, sourceAssets, feeAsset, lockFunds);
|
|
105
|
+
async function sendTransactionAsIntent(config, sourceChains, targetChain, callInputs, gasLimit, tokenRequests, recipient, accountAddress, dryRun = false, signers, sponsored, settlementLayers, sourceAssets, feeAsset, lockFunds) {
|
|
106
|
+
const intentRoute = await (0, utils_2.prepareTransactionAsIntent)(config, sourceChains, targetChain, callInputs, gasLimit, tokenRequests, recipient, accountAddress, sponsored ?? false, undefined, settlementLayers, sourceAssets, feeAsset, lockFunds);
|
|
105
107
|
if (!intentRoute) {
|
|
106
108
|
throw new error_1.OrderPathRequiredForIntentsError();
|
|
107
109
|
}
|
|
@@ -205,14 +207,32 @@ async function waitForExecution(config, result, acceptsPreconfirmations) {
|
|
|
205
207
|
}
|
|
206
208
|
}
|
|
207
209
|
}
|
|
208
|
-
async function getMaxSpendableAmount(config, chain,
|
|
210
|
+
async function getMaxSpendableAmount(config, chain, token, gasUnits, sponsored = false) {
|
|
209
211
|
const address = (0, accounts_1.getAddress)(config);
|
|
210
212
|
const orchestrator = (0, utils_2.getOrchestratorByChain)(chain.id, config.apiKey, config.endpointUrl);
|
|
213
|
+
const tokenAddress = (0, registry_1.resolveTokenAddress)(token, chain.id);
|
|
211
214
|
return orchestrator.getMaxTokenAmount(address, chain.id, tokenAddress, gasUnits, sponsored);
|
|
212
215
|
}
|
|
213
216
|
async function getPortfolio(config, onTestnets) {
|
|
214
217
|
const address = (0, accounts_1.getAddress)(config);
|
|
215
|
-
const chainId = onTestnets ? chains_1.
|
|
218
|
+
const chainId = onTestnets ? chains_1.baseSepolia.id : chains_1.base.id;
|
|
216
219
|
const orchestrator = (0, utils_2.getOrchestratorByChain)(chainId, config.apiKey, config.endpointUrl);
|
|
217
220
|
return orchestrator.getPortfolio(address);
|
|
218
221
|
}
|
|
222
|
+
async function getIntentStatus(apiKey, endpointUrl, intentId) {
|
|
223
|
+
const environment = BigInt(intentId.toString().slice(0, 1));
|
|
224
|
+
const chainId = environment === 4n ? chains_1.base.id : chains_1.baseSepolia.id;
|
|
225
|
+
const orchestrator = (0, utils_2.getOrchestratorByChain)(chainId, apiKey, endpointUrl);
|
|
226
|
+
const internalStatus = await orchestrator.getIntentOpStatus(intentId);
|
|
227
|
+
return {
|
|
228
|
+
status: internalStatus.status,
|
|
229
|
+
fill: {
|
|
230
|
+
hash: internalStatus.fillTransactionHash,
|
|
231
|
+
chainId: chainId,
|
|
232
|
+
},
|
|
233
|
+
claims: internalStatus.claims.map((claim) => ({
|
|
234
|
+
hash: claim.claimTransactionHash,
|
|
235
|
+
chainId: claim.chainId,
|
|
236
|
+
})),
|
|
237
|
+
};
|
|
238
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Address } from 'viem';
|
|
2
|
+
import type { Execution, IntentOpElement } from '../orchestrator/types';
|
|
3
|
+
declare function getTypedData(account: Address, intentExecutorAddress: Address, element: IntentOpElement, nonce: bigint): {
|
|
4
|
+
domain: {
|
|
5
|
+
name: string;
|
|
6
|
+
version: string;
|
|
7
|
+
chainId: number;
|
|
8
|
+
verifyingContract: `0x${string}`;
|
|
9
|
+
};
|
|
10
|
+
types: {
|
|
11
|
+
SingleChainOps: {
|
|
12
|
+
name: string;
|
|
13
|
+
type: string;
|
|
14
|
+
}[];
|
|
15
|
+
Op: {
|
|
16
|
+
name: string;
|
|
17
|
+
type: string;
|
|
18
|
+
}[];
|
|
19
|
+
};
|
|
20
|
+
primaryType: "SingleChainOps";
|
|
21
|
+
message: {
|
|
22
|
+
account: `0x${string}`;
|
|
23
|
+
nonce: bigint;
|
|
24
|
+
ops: Execution[];
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export { getTypedData };
|
|
28
|
+
//# sourceMappingURL=singleChainOps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"singleChainOps.d.ts","sourceRoot":"","sources":["../../../execution/singleChainOps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvE,iBAAS,YAAY,CACnB,OAAO,EAAE,OAAO,EAChB,qBAAqB,EAAE,OAAO,EAC9B,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;EA8Bd;AACD,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -1,26 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getTypedData = getTypedData;
|
|
4
|
-
function getTypedData(account, intentExecutorAddress,
|
|
5
|
-
const ops =
|
|
6
|
-
const chainOps = {
|
|
7
|
-
chainId: BigInt(intentOp.elements[0].chainId),
|
|
8
|
-
nonce: BigInt(intentOp.nonce),
|
|
9
|
-
ops,
|
|
10
|
-
};
|
|
4
|
+
function getTypedData(account, intentExecutorAddress, element, nonce) {
|
|
5
|
+
const ops = element.mandate.destinationOps;
|
|
11
6
|
return {
|
|
12
7
|
domain: {
|
|
13
8
|
name: 'IntentExecutor',
|
|
14
9
|
version: 'v0.0.1',
|
|
10
|
+
chainId: Number(element.mandate.destinationChainId),
|
|
15
11
|
verifyingContract: intentExecutorAddress,
|
|
16
12
|
},
|
|
17
13
|
types: {
|
|
18
|
-
|
|
14
|
+
SingleChainOps: [
|
|
19
15
|
{ name: 'account', type: 'address' },
|
|
20
|
-
{ name: 'ops', type: 'ChainOps[]' },
|
|
21
|
-
],
|
|
22
|
-
ChainOps: [
|
|
23
|
-
{ name: 'chainId', type: 'uint256' },
|
|
24
16
|
{ name: 'nonce', type: 'uint256' },
|
|
25
17
|
{ name: 'ops', type: 'Op[]' },
|
|
26
18
|
],
|
|
@@ -30,10 +22,11 @@ function getTypedData(account, intentExecutorAddress, intentOp) {
|
|
|
30
22
|
{ name: 'data', type: 'bytes' },
|
|
31
23
|
],
|
|
32
24
|
},
|
|
33
|
-
primaryType: '
|
|
25
|
+
primaryType: 'SingleChainOps',
|
|
34
26
|
message: {
|
|
35
27
|
account,
|
|
36
|
-
|
|
28
|
+
nonce,
|
|
29
|
+
ops,
|
|
37
30
|
},
|
|
38
31
|
};
|
|
39
32
|
}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { type Chain, type Hex } from 'viem';
|
|
2
|
-
import { type
|
|
2
|
+
import { type EnableSessionData } from '../modules/validators/smart-sessions';
|
|
3
3
|
import type { RhinestoneConfig, Session } from '../types';
|
|
4
4
|
interface SessionDetails {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
hashesAndChainIds: ChainDigest[];
|
|
5
|
+
signature: Hex;
|
|
6
|
+
nonces: bigint[];
|
|
8
7
|
enableSessionData: EnableSessionData;
|
|
9
8
|
}
|
|
10
|
-
declare function getSessionDetails(config: RhinestoneConfig, sessions: Session[], sessionIndex: number, signature?: Hex): Promise<SessionDetails>;
|
|
11
|
-
declare function getMultichainDigest(chainDigests: ChainDigest[]): Hex;
|
|
9
|
+
declare function getSessionDetails(config: RhinestoneConfig, sessions: Session[], sessionIndex: number, initialNonces?: bigint[], signature?: Hex): Promise<SessionDetails>;
|
|
12
10
|
declare function enableSmartSession(chain: Chain, config: RhinestoneConfig, session: Session): Promise<void>;
|
|
13
|
-
export { enableSmartSession, getSessionDetails
|
|
11
|
+
export { enableSmartSession, getSessionDetails };
|
|
14
12
|
export type { SessionDetails };
|
|
15
13
|
//# sourceMappingURL=smart-session.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smart-session.d.ts","sourceRoot":"","sources":["../../../execution/smart-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,KAAK,
|
|
1
|
+
{"version":3,"file":"smart-session.d.ts","sourceRoot":"","sources":["../../../execution/smart-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,KAAK,EAEV,KAAK,GAAG,EAIT,MAAM,MAAM,CAAA;AAiBb,OAAO,EACL,KAAK,iBAAiB,EAKvB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAGzD,UAAU,cAAc;IACtB,SAAS,EAAE,GAAG,CAAA;IACd,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,iBAAiB,EAAE,iBAAiB,CAAA;CACrC;AA6CD,iBAAe,iBAAiB,CAC9B,MAAM,EAAE,gBAAgB,EACxB,QAAQ,EAAE,OAAO,EAAE,EACnB,YAAY,EAAE,MAAM,EACpB,aAAa,CAAC,EAAE,MAAM,EAAE,EACxB,SAAS,CAAC,EAAE,GAAG,GACd,OAAO,CAAC,cAAc,CAAC,CAiHzB;AA+BD,iBAAe,kBAAkB,CAC/B,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,OAAO,iBA2BjB;AAED,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,CAAA;AAChD,YAAY,EAAE,cAAc,EAAE,CAAA"}
|