@rhinestone/sdk 0.1.0
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 +168 -0
- package/dist/example.d.ts +1 -0
- package/dist/example.d.ts.map +1 -0
- package/dist/example.js +129 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/package.json +1 -0
- package/dist/services/account.d.ts +13 -0
- package/dist/services/account.d.ts.map +1 -0
- package/dist/services/account.js +127 -0
- package/dist/services/modules.d.ts +34 -0
- package/dist/services/modules.d.ts.map +1 -0
- package/dist/services/modules.js +174 -0
- package/dist/services/orchestrator/client.d.ts +30 -0
- package/dist/services/orchestrator/client.d.ts.map +1 -0
- package/dist/services/orchestrator/client.js +203 -0
- package/dist/services/orchestrator/consts.d.ts +6 -0
- package/dist/services/orchestrator/consts.d.ts.map +1 -0
- package/dist/services/orchestrator/consts.js +4 -0
- package/dist/services/orchestrator/error.d.ts +17 -0
- package/dist/services/orchestrator/error.d.ts.map +1 -0
- package/dist/services/orchestrator/error.js +25 -0
- package/dist/services/orchestrator/index.d.ts +8 -0
- package/dist/services/orchestrator/index.d.ts.map +1 -0
- package/dist/services/orchestrator/index.js +9 -0
- package/dist/services/orchestrator/types.d.ts +147 -0
- package/dist/services/orchestrator/types.d.ts.map +1 -0
- package/dist/services/orchestrator/types.js +6 -0
- package/dist/services/orchestrator/utils.d.ts +7 -0
- package/dist/services/orchestrator/utils.d.ts.map +1 -0
- package/dist/services/orchestrator/utils.js +196 -0
- package/dist/services/transaction.d.ts +6 -0
- package/dist/services/transaction.d.ts.map +1 -0
- package/dist/services/transaction.js +93 -0
- package/dist/types.d.ts +45 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/package.json +43 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { bytesToHex, encodeAbiParameters, hexToBytes, keccak256, toHex, } from 'viem';
|
|
2
|
+
import { arbitrum, arbitrumSepolia, base, baseSepolia, optimism, optimismSepolia, polygon, polygonAmoy, } from 'viem/chains';
|
|
3
|
+
const SAFE_7579_LAUNCHPAD_ADDRESS = '0x7579011aB74c46090561ea277Ba79D510c6C00ff';
|
|
4
|
+
const SAFE_7579_ADAPTER_ADDRESS = '0x7579ee8307284f293b1927136486880611f20002';
|
|
5
|
+
const OMNI_ACCOUNT_MOCK_ATTESTER_ADDRESS = '0x6D0515e8E499468DCe9583626f0cA15b887f9d03';
|
|
6
|
+
const RHINESTONE_ATTESTER_ADDRESS = '0x000000333034E9f539ce08819E12c1b8Cb29084d';
|
|
7
|
+
const OWNABLE_VALIDATOR_ADDRESS = '0x2483DA3A338895199E5e538530213157e931Bf06';
|
|
8
|
+
const WEBAUTHN_VALIDATOR_ADDRESS = '0x2f167e55d42584f65e2e30a748f41ee75a311414';
|
|
9
|
+
const NO_SAFE_OWNER_ADDRESS = '0xbabe99e62d8bcbd3acf5ccbcfcd4f64fe75e5e72';
|
|
10
|
+
function toOwners(config) {
|
|
11
|
+
const ownerSet = config.owners;
|
|
12
|
+
switch (ownerSet.type) {
|
|
13
|
+
case 'ecdsa':
|
|
14
|
+
return ownerSet.accounts.map((account) => account.address);
|
|
15
|
+
case 'passkey':
|
|
16
|
+
return [NO_SAFE_OWNER_ADDRESS];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function getValidator(config) {
|
|
20
|
+
const ownerSet = config.owners;
|
|
21
|
+
switch (ownerSet.type) {
|
|
22
|
+
case 'ecdsa':
|
|
23
|
+
return getOwnableValidator({
|
|
24
|
+
threshold: ownerSet.threshold ?? 1,
|
|
25
|
+
owners: ownerSet.accounts.map((account) => account.address),
|
|
26
|
+
});
|
|
27
|
+
case 'passkey':
|
|
28
|
+
return getWebAuthnValidator({
|
|
29
|
+
pubKey: ownerSet.account.publicKey,
|
|
30
|
+
authenticatorId: ownerSet.account.id,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function getOwnableValidator({ threshold, owners, }) {
|
|
35
|
+
return {
|
|
36
|
+
address: OWNABLE_VALIDATOR_ADDRESS,
|
|
37
|
+
initData: encodeAbiParameters([
|
|
38
|
+
{ name: 'threshold', type: 'uint256' },
|
|
39
|
+
{ name: 'owners', type: 'address[]' },
|
|
40
|
+
], [BigInt(threshold), owners.sort()]),
|
|
41
|
+
deInitData: '0x',
|
|
42
|
+
additionalContext: '0x',
|
|
43
|
+
type: 'validator',
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function getWebAuthnValidator(webAuthnCredential) {
|
|
47
|
+
let pubKeyX;
|
|
48
|
+
let pubKeyY;
|
|
49
|
+
// Distinguish between PublicKey and Hex / byte encoded public key
|
|
50
|
+
if (typeof webAuthnCredential.pubKey === 'string' ||
|
|
51
|
+
webAuthnCredential.pubKey instanceof Uint8Array) {
|
|
52
|
+
// It's a P256Credential
|
|
53
|
+
const { x, y, prefix } = parsePublicKey(webAuthnCredential.pubKey);
|
|
54
|
+
pubKeyX = x;
|
|
55
|
+
pubKeyY = y;
|
|
56
|
+
if (prefix && prefix !== 4) {
|
|
57
|
+
throw new Error('Only uncompressed public keys are supported');
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
// It's already a PublicKey
|
|
62
|
+
pubKeyX = webAuthnCredential.pubKey.x;
|
|
63
|
+
pubKeyY = webAuthnCredential.pubKey.y;
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
address: WEBAUTHN_VALIDATOR_ADDRESS,
|
|
67
|
+
initData: encodeAbiParameters([
|
|
68
|
+
{
|
|
69
|
+
components: [
|
|
70
|
+
{
|
|
71
|
+
name: 'pubKeyX',
|
|
72
|
+
type: 'uint256',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: 'pubKeyY',
|
|
76
|
+
type: 'uint256',
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
type: 'tuple',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
type: 'bytes32',
|
|
83
|
+
name: 'authenticatorIdHash',
|
|
84
|
+
},
|
|
85
|
+
], [
|
|
86
|
+
{
|
|
87
|
+
pubKeyX,
|
|
88
|
+
pubKeyY,
|
|
89
|
+
},
|
|
90
|
+
keccak256(toHex(webAuthnCredential.authenticatorId)),
|
|
91
|
+
]),
|
|
92
|
+
deInitData: '0x',
|
|
93
|
+
additionalContext: '0x',
|
|
94
|
+
type: 'validator',
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
export function getWebauthnValidatorSignature({ webauthn, signature, usePrecompiled = false, }) {
|
|
98
|
+
const { authenticatorData, clientDataJSON, typeIndex } = webauthn;
|
|
99
|
+
let r;
|
|
100
|
+
let s;
|
|
101
|
+
if (typeof signature === 'string' || signature instanceof Uint8Array) {
|
|
102
|
+
const parsedSignature = parseSignature(signature);
|
|
103
|
+
r = parsedSignature.r;
|
|
104
|
+
s = parsedSignature.s;
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
r = signature.r;
|
|
108
|
+
s = signature.s;
|
|
109
|
+
}
|
|
110
|
+
return encodeAbiParameters([
|
|
111
|
+
{ type: 'bytes', name: 'authenticatorData' },
|
|
112
|
+
{
|
|
113
|
+
type: 'string',
|
|
114
|
+
name: 'clientDataJSON',
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
type: 'uint256',
|
|
118
|
+
name: 'responseTypeLocation',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
type: 'uint256',
|
|
122
|
+
name: 'r',
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
type: 'uint256',
|
|
126
|
+
name: 's',
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
type: 'bool',
|
|
130
|
+
name: 'usePrecompiled',
|
|
131
|
+
},
|
|
132
|
+
], [
|
|
133
|
+
authenticatorData,
|
|
134
|
+
clientDataJSON,
|
|
135
|
+
typeof typeIndex === 'bigint' ? typeIndex : BigInt(typeIndex),
|
|
136
|
+
r,
|
|
137
|
+
s,
|
|
138
|
+
usePrecompiled,
|
|
139
|
+
]);
|
|
140
|
+
}
|
|
141
|
+
export function isRip7212SupportedNetwork(chain) {
|
|
142
|
+
const supportedChains = [
|
|
143
|
+
optimism,
|
|
144
|
+
optimismSepolia,
|
|
145
|
+
polygon,
|
|
146
|
+
polygonAmoy,
|
|
147
|
+
base,
|
|
148
|
+
baseSepolia,
|
|
149
|
+
arbitrum,
|
|
150
|
+
arbitrumSepolia,
|
|
151
|
+
];
|
|
152
|
+
return supportedChains.includes(chain);
|
|
153
|
+
}
|
|
154
|
+
function parseSignature(signature) {
|
|
155
|
+
const bytes = typeof signature === 'string' ? hexToBytes(signature) : signature;
|
|
156
|
+
const r = bytes.slice(0, 32);
|
|
157
|
+
const s = bytes.slice(32, 64);
|
|
158
|
+
return {
|
|
159
|
+
r: BigInt(bytesToHex(r)),
|
|
160
|
+
s: BigInt(bytesToHex(s)),
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
function parsePublicKey(publicKey) {
|
|
164
|
+
const bytes = typeof publicKey === 'string' ? hexToBytes(publicKey) : publicKey;
|
|
165
|
+
const offset = bytes.length === 65 ? 1 : 0;
|
|
166
|
+
const x = bytes.slice(offset, 32 + offset);
|
|
167
|
+
const y = bytes.slice(32 + offset, 64 + offset);
|
|
168
|
+
return {
|
|
169
|
+
prefix: bytes.length === 65 ? bytes[0] : undefined,
|
|
170
|
+
x: BigInt(bytesToHex(x)),
|
|
171
|
+
y: BigInt(bytesToHex(y)),
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
export { getValidator, toOwners, SAFE_7579_LAUNCHPAD_ADDRESS, SAFE_7579_ADAPTER_ADDRESS, OMNI_ACCOUNT_MOCK_ATTESTER_ADDRESS, RHINESTONE_ATTESTER_ADDRESS, };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Address, Hex } from 'viem';
|
|
2
|
+
import { UserOperation } from 'viem/account-abstraction';
|
|
3
|
+
import { type UserTokenBalance, type MetaIntent, type MultiChainCompact, type Execution, type SignedMultiChainCompact, type PostOrderBundleResult, type BundleResult, type BundleEvent } from './types';
|
|
4
|
+
export declare class Orchestrator {
|
|
5
|
+
private serverUrl;
|
|
6
|
+
private apiKey;
|
|
7
|
+
constructor(serverUrl: string, apiKey: string);
|
|
8
|
+
getPortfolio(userAddress: Address, filter?: {
|
|
9
|
+
chainIds?: number[];
|
|
10
|
+
tokens?: {
|
|
11
|
+
[chainId: number]: Address[];
|
|
12
|
+
};
|
|
13
|
+
}): Promise<UserTokenBalance[]>;
|
|
14
|
+
getOrderPath(intent: MetaIntent, userAddress: Address): Promise<{
|
|
15
|
+
orderBundle: MultiChainCompact;
|
|
16
|
+
injectedExecutions: Execution[];
|
|
17
|
+
}[]>;
|
|
18
|
+
postSignedOrderBundle(signedOrderBundles: {
|
|
19
|
+
signedOrderBundle: SignedMultiChainCompact;
|
|
20
|
+
initCode?: Hex;
|
|
21
|
+
userOp?: UserOperation;
|
|
22
|
+
}[]): Promise<PostOrderBundleResult>;
|
|
23
|
+
getBundleStatus(bundleId: bigint): Promise<BundleResult>;
|
|
24
|
+
getPendingBundles(count?: number, offset?: number): Promise<{
|
|
25
|
+
pendingBundles: BundleEvent[];
|
|
26
|
+
nextOffset?: number;
|
|
27
|
+
}>;
|
|
28
|
+
private parseError;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../services/orchestrator/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,GAAG,EAAU,MAAM,MAAM,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAExD,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EACjB,KAAK,WAAW,EACjB,MAAM,SAAS,CAAA;AAQhB,qBAAa,YAAY;IACvB,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,MAAM,CAAQ;gBAEV,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAKvC,YAAY,CAChB,WAAW,EAAE,OAAO,EACpB,MAAM,CAAC,EAAE;QACP,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;QACnB,MAAM,CAAC,EAAE;YACP,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,EAAE,CAAA;SAC7B,CAAA;KACF,GACA,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAwCxB,YAAY,CAChB,MAAM,EAAE,UAAU,EAClB,WAAW,EAAE,OAAO,GACnB,OAAO,CACR;QACE,WAAW,EAAE,iBAAiB,CAAA;QAC9B,kBAAkB,EAAE,SAAS,EAAE,CAAA;KAChC,EAAE,CACJ;IA+BK,qBAAqB,CACzB,kBAAkB,EAAE;QAClB,iBAAiB,EAAE,uBAAuB,CAAA;QAC1C,QAAQ,CAAC,EAAE,GAAG,CAAA;QACd,MAAM,CAAC,EAAE,aAAa,CAAA;KACvB,EAAE,GACF,OAAO,CAAC,qBAAqB,CAAC;IA2C3B,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAyBxD,iBAAiB,CACrB,KAAK,GAAE,MAAW,EAClB,MAAM,GAAE,MAAU,GACjB,OAAO,CAAC;QAAE,cAAc,EAAE,WAAW,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAuBlE,OAAO,CAAC,UAAU;CA6DnB"}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { concat } from 'viem';
|
|
3
|
+
import { convertBigIntFields, parseCompactResponse, parsePendingBundleEvent, } from './utils';
|
|
4
|
+
import { OrchestratorError } from './error';
|
|
5
|
+
export class Orchestrator {
|
|
6
|
+
serverUrl;
|
|
7
|
+
apiKey;
|
|
8
|
+
constructor(serverUrl, apiKey) {
|
|
9
|
+
this.serverUrl = serverUrl;
|
|
10
|
+
this.apiKey = apiKey;
|
|
11
|
+
}
|
|
12
|
+
async getPortfolio(userAddress, filter) {
|
|
13
|
+
try {
|
|
14
|
+
const response = await axios.get(`${this.serverUrl}/accounts/${userAddress}/portfolio`, {
|
|
15
|
+
params: {
|
|
16
|
+
chainIds: filter?.chainIds,
|
|
17
|
+
tokens: filter?.tokens
|
|
18
|
+
? Object.entries(filter.tokens)
|
|
19
|
+
.map(([chainId, tokens]) => tokens.map((token) => `${chainId}:${token}`))
|
|
20
|
+
.reduce(concat, [])
|
|
21
|
+
: undefined,
|
|
22
|
+
},
|
|
23
|
+
headers: {
|
|
24
|
+
'x-api-key': this.apiKey,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
return response.data.portfolio.map((balance) => {
|
|
28
|
+
return {
|
|
29
|
+
...balance,
|
|
30
|
+
balance: BigInt(balance.balance),
|
|
31
|
+
tokenChainBalance: balance.tokenChainBalance.map((chainBalance) => {
|
|
32
|
+
return {
|
|
33
|
+
...chainBalance,
|
|
34
|
+
balance: BigInt(chainBalance.balance),
|
|
35
|
+
};
|
|
36
|
+
}),
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
this.parseError(error);
|
|
42
|
+
throw new Error('Failed to get portfolio');
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async getOrderPath(intent, userAddress) {
|
|
46
|
+
try {
|
|
47
|
+
const response = await axios.post(`${this.serverUrl}/accounts/${userAddress}/bundles/path`, {
|
|
48
|
+
...convertBigIntFields(intent),
|
|
49
|
+
}, {
|
|
50
|
+
headers: {
|
|
51
|
+
'x-api-key': this.apiKey,
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
return response.data.orderBundles.map((orderPath) => {
|
|
55
|
+
return {
|
|
56
|
+
orderBundle: parseCompactResponse(orderPath.orderBundle),
|
|
57
|
+
injectedExecutions: orderPath.injectedExecutions.map((exec) => {
|
|
58
|
+
return {
|
|
59
|
+
...exec,
|
|
60
|
+
value: BigInt(exec.value),
|
|
61
|
+
};
|
|
62
|
+
}),
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
this.parseError(error);
|
|
68
|
+
throw new Error(error);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async postSignedOrderBundle(signedOrderBundles) {
|
|
72
|
+
try {
|
|
73
|
+
const bundles = signedOrderBundles.map((signedOrderBundle) => {
|
|
74
|
+
return {
|
|
75
|
+
signedOrderBundle: convertBigIntFields(signedOrderBundle.signedOrderBundle),
|
|
76
|
+
initCode: signedOrderBundle.initCode,
|
|
77
|
+
userOp: signedOrderBundle.userOp
|
|
78
|
+
? convertBigIntFields(signedOrderBundle.userOp)
|
|
79
|
+
: undefined,
|
|
80
|
+
};
|
|
81
|
+
});
|
|
82
|
+
const response = await axios.post(`${this.serverUrl}/bundles`, {
|
|
83
|
+
bundles,
|
|
84
|
+
}, {
|
|
85
|
+
headers: {
|
|
86
|
+
'x-api-key': this.apiKey,
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
return response.data.bundleResults.map((bundleResult) => {
|
|
90
|
+
return {
|
|
91
|
+
...bundleResult,
|
|
92
|
+
bundleId: BigInt(bundleResult.bundleId),
|
|
93
|
+
};
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
this.parseError(error);
|
|
98
|
+
throw new Error('Failed to post order bundle');
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
async getBundleStatus(bundleId) {
|
|
102
|
+
try {
|
|
103
|
+
const response = await axios.get(`${this.serverUrl}/bundles/${bundleId.toString()}`, {
|
|
104
|
+
headers: {
|
|
105
|
+
'x-api-key': this.apiKey,
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
response.data.claims = response.data.claims.map((claim) => {
|
|
109
|
+
return {
|
|
110
|
+
...claim,
|
|
111
|
+
depositId: BigInt(claim.depositId),
|
|
112
|
+
};
|
|
113
|
+
});
|
|
114
|
+
return response.data;
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
this.parseError(error);
|
|
118
|
+
throw new Error('Failed to get bundle status');
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
async getPendingBundles(count = 20, offset = 0) {
|
|
122
|
+
try {
|
|
123
|
+
const response = await axios.get(`${this.serverUrl}/bundles/events`, {
|
|
124
|
+
params: {
|
|
125
|
+
count,
|
|
126
|
+
offset,
|
|
127
|
+
},
|
|
128
|
+
headers: {
|
|
129
|
+
'x-api-key': this.apiKey,
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
const { events: pendingBundles, nextOffset } = response.data;
|
|
133
|
+
return {
|
|
134
|
+
pendingBundles: pendingBundles.map(parsePendingBundleEvent),
|
|
135
|
+
nextOffset,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
this.parseError(error);
|
|
140
|
+
throw new Error('Failed to get pending bundles');
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
parseError(error) {
|
|
144
|
+
if (error.response) {
|
|
145
|
+
let errorType;
|
|
146
|
+
if (error.response.status) {
|
|
147
|
+
switch (error.response.status) {
|
|
148
|
+
case 400:
|
|
149
|
+
errorType = 'Bad Request';
|
|
150
|
+
break;
|
|
151
|
+
case 401:
|
|
152
|
+
errorType = 'Unauthorized';
|
|
153
|
+
break;
|
|
154
|
+
case 403:
|
|
155
|
+
errorType = 'Forbidden';
|
|
156
|
+
break;
|
|
157
|
+
case 404:
|
|
158
|
+
errorType = 'Not Found';
|
|
159
|
+
break;
|
|
160
|
+
case 409:
|
|
161
|
+
errorType = 'Conflict';
|
|
162
|
+
break;
|
|
163
|
+
case 422:
|
|
164
|
+
errorType = 'Unprocessable Entity';
|
|
165
|
+
break;
|
|
166
|
+
case 500:
|
|
167
|
+
errorType = 'Internal Server Error';
|
|
168
|
+
break;
|
|
169
|
+
default:
|
|
170
|
+
errorType = 'Unknown';
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
let context = {};
|
|
174
|
+
if (error.response.data) {
|
|
175
|
+
const { errors, traceId } = error.response.data;
|
|
176
|
+
for (const err of errors) {
|
|
177
|
+
let errorMessage = `Rhinestone Error: ${err.message}`;
|
|
178
|
+
if (errorType) {
|
|
179
|
+
errorMessage += ` (${errorType})`;
|
|
180
|
+
}
|
|
181
|
+
if (traceId) {
|
|
182
|
+
errorMessage += ` [Trace ID: ${traceId}]`;
|
|
183
|
+
context.traceId = traceId;
|
|
184
|
+
}
|
|
185
|
+
console.error(errorMessage);
|
|
186
|
+
if (err.context) {
|
|
187
|
+
console.error(`Context: ${JSON.stringify(err.context, undefined, 4)}`);
|
|
188
|
+
}
|
|
189
|
+
context = { ...context, ...err.context };
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
console.error(error);
|
|
194
|
+
}
|
|
195
|
+
throw new OrchestratorError({
|
|
196
|
+
message: error.response.data.errors[0].message,
|
|
197
|
+
context,
|
|
198
|
+
errorType,
|
|
199
|
+
traceId: context['traceId'],
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Address } from 'viem';
|
|
2
|
+
export declare const ORCHESTRATOR_URL = "https://orchestrator.rhinestone.wtf";
|
|
3
|
+
export declare const HOOK_ADDRESS: Address;
|
|
4
|
+
export declare const TARGET_MODULE_ADDRESS: Address;
|
|
5
|
+
export declare const SAME_CHAIN_MODULE_ADDRESS: Address;
|
|
6
|
+
//# sourceMappingURL=consts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../../services/orchestrator/consts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAE9B,eAAO,MAAM,gBAAgB,wCAAwC,CAAA;AAErE,eAAO,MAAM,YAAY,EAAE,OACmB,CAAA;AAC9C,eAAO,MAAM,qBAAqB,EAAE,OACU,CAAA;AAC9C,eAAO,MAAM,yBAAyB,EAAE,OACM,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export const ORCHESTRATOR_URL = 'https://orchestrator.rhinestone.wtf';
|
|
2
|
+
export const HOOK_ADDRESS = '0x0000000000f6Ed8Be424d673c63eeFF8b9267420';
|
|
3
|
+
export const TARGET_MODULE_ADDRESS = '0x0000000000E5a37279A001301A837a91b5de1D5E';
|
|
4
|
+
export const SAME_CHAIN_MODULE_ADDRESS = '0x000000000043ff16d5776c7F0f65Ec485C17Ca04';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare class OrchestratorError 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
|
+
//# sourceMappingURL=error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../services/orchestrator/error.ts"],"names":[],"mappings":"AAAA,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,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"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export class OrchestratorError extends Error {
|
|
2
|
+
_message;
|
|
3
|
+
_context;
|
|
4
|
+
_errorType;
|
|
5
|
+
_traceId;
|
|
6
|
+
constructor(params) {
|
|
7
|
+
super();
|
|
8
|
+
this._message = params?.message || 'OrchestratorError ';
|
|
9
|
+
this._context = params?.context || {};
|
|
10
|
+
this._errorType = params?.errorType || 'Unknown';
|
|
11
|
+
this._traceId = params?.traceId || '';
|
|
12
|
+
}
|
|
13
|
+
get message() {
|
|
14
|
+
return this._message;
|
|
15
|
+
}
|
|
16
|
+
get context() {
|
|
17
|
+
return this._context;
|
|
18
|
+
}
|
|
19
|
+
get errorType() {
|
|
20
|
+
return this._errorType;
|
|
21
|
+
}
|
|
22
|
+
get traceId() {
|
|
23
|
+
return this._traceId;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { OrchestratorError } from './error';
|
|
2
|
+
import { HOOK_ADDRESS, TARGET_MODULE_ADDRESS, SAME_CHAIN_MODULE_ADDRESS } from './consts';
|
|
3
|
+
import { Orchestrator } from './client';
|
|
4
|
+
import { getOrderBundleHash } from './utils';
|
|
5
|
+
export declare function getOrchestrator(apiKey: string, orchestratorUrl?: string): Orchestrator;
|
|
6
|
+
export * from './types';
|
|
7
|
+
export { HOOK_ADDRESS, TARGET_MODULE_ADDRESS, SAME_CHAIN_MODULE_ADDRESS, Orchestrator, OrchestratorError, getOrderBundleHash, };
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../services/orchestrator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAC3C,OAAO,EAEL,YAAY,EACZ,qBAAqB,EACrB,yBAAyB,EAC1B,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAE5C,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,eAAe,CAAC,EAAE,MAAM,GACvB,YAAY,CAEd;AAED,cAAc,SAAS,CAAA;AACvB,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,yBAAyB,EACzB,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,GACnB,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { OrchestratorError } from './error';
|
|
2
|
+
import { ORCHESTRATOR_URL, HOOK_ADDRESS, TARGET_MODULE_ADDRESS, SAME_CHAIN_MODULE_ADDRESS, } from './consts';
|
|
3
|
+
import { Orchestrator } from './client';
|
|
4
|
+
import { getOrderBundleHash } from './utils';
|
|
5
|
+
export function getOrchestrator(apiKey, orchestratorUrl) {
|
|
6
|
+
return new Orchestrator(orchestratorUrl ?? ORCHESTRATOR_URL, apiKey);
|
|
7
|
+
}
|
|
8
|
+
export * from './types';
|
|
9
|
+
export { HOOK_ADDRESS, TARGET_MODULE_ADDRESS, SAME_CHAIN_MODULE_ADDRESS, Orchestrator, OrchestratorError, getOrderBundleHash, };
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { Address, Hex } from 'viem';
|
|
2
|
+
import type { UserOperation } from 'viem/account-abstraction';
|
|
3
|
+
import { sepolia, baseSepolia, arbitrumSepolia, optimismSepolia, polygonAmoy, mainnet, base, arbitrum, optimism, polygon } from 'viem/chains';
|
|
4
|
+
type SupportedTestnet = typeof sepolia.id | typeof baseSepolia.id | typeof arbitrumSepolia.id | typeof optimismSepolia.id | typeof polygonAmoy.id;
|
|
5
|
+
type SupportedMainnet = typeof mainnet.id | typeof base.id | typeof arbitrum.id | typeof optimism.id | typeof polygon.id;
|
|
6
|
+
export type SupportedChain = SupportedMainnet | SupportedTestnet;
|
|
7
|
+
export declare const BUNDLE_STATUS_PENDING = "PENDING";
|
|
8
|
+
export declare const BUNDLE_STATUS_FAILED = "FAILED";
|
|
9
|
+
export declare const BUNDLE_STATUS_EXPIRED = "EXPIRED";
|
|
10
|
+
export declare const BUNDLE_STATUS_PARTIALLY_COMPLETED = "PARTIALLY_COMPLETED";
|
|
11
|
+
export declare const BUNDLE_STATUS_COMPLETED = "COMPLETED";
|
|
12
|
+
export declare const BUNDLE_STATUS_UNKNOWN = "UNKNOWN";
|
|
13
|
+
export type BundleStatus = typeof BUNDLE_STATUS_PENDING | typeof BUNDLE_STATUS_EXPIRED | typeof BUNDLE_STATUS_PARTIALLY_COMPLETED | typeof BUNDLE_STATUS_COMPLETED | typeof BUNDLE_STATUS_FAILED | typeof BUNDLE_STATUS_UNKNOWN;
|
|
14
|
+
type ClaimStatus = 'PENDING' | 'EXPIRED' | 'CLAIMED';
|
|
15
|
+
interface Claim {
|
|
16
|
+
depositId: bigint;
|
|
17
|
+
chainId: number;
|
|
18
|
+
status: ClaimStatus;
|
|
19
|
+
claimTimestamp?: number;
|
|
20
|
+
claimTransactionHash?: Hex;
|
|
21
|
+
}
|
|
22
|
+
export interface Execution {
|
|
23
|
+
to: Address;
|
|
24
|
+
value: bigint;
|
|
25
|
+
data: Hex;
|
|
26
|
+
}
|
|
27
|
+
type SimulationResult = {
|
|
28
|
+
success: true;
|
|
29
|
+
} | {
|
|
30
|
+
success: false;
|
|
31
|
+
call: Execution;
|
|
32
|
+
details: {
|
|
33
|
+
message: string;
|
|
34
|
+
contractAddress: Address;
|
|
35
|
+
args: any[];
|
|
36
|
+
functionName: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export type PostOrderBundleResult = ({
|
|
40
|
+
bundleId: bigint;
|
|
41
|
+
status: typeof BUNDLE_STATUS_PENDING;
|
|
42
|
+
} | {
|
|
43
|
+
bundleId: bigint;
|
|
44
|
+
status: typeof BUNDLE_STATUS_FAILED;
|
|
45
|
+
error: SimulationResult;
|
|
46
|
+
})[];
|
|
47
|
+
export interface BundleResult {
|
|
48
|
+
status: BundleStatus;
|
|
49
|
+
fillTimestamp?: number;
|
|
50
|
+
fillTransactionHash?: Hex;
|
|
51
|
+
claims: Claim[];
|
|
52
|
+
}
|
|
53
|
+
interface TokenTransfer {
|
|
54
|
+
tokenAddress: Address;
|
|
55
|
+
amount: bigint;
|
|
56
|
+
}
|
|
57
|
+
interface WithUserOp {
|
|
58
|
+
userOp: UserOperation;
|
|
59
|
+
targetExecutions?: never;
|
|
60
|
+
}
|
|
61
|
+
interface WithExecutions {
|
|
62
|
+
userOp?: never;
|
|
63
|
+
targetExecutions: Execution[];
|
|
64
|
+
}
|
|
65
|
+
interface WithoutOperation {
|
|
66
|
+
userOp?: never;
|
|
67
|
+
targetExecutions?: never;
|
|
68
|
+
}
|
|
69
|
+
interface MetaIntentBase {
|
|
70
|
+
targetChainId: number;
|
|
71
|
+
tokenTransfers: TokenTransfer[];
|
|
72
|
+
targetAccount: Address;
|
|
73
|
+
accountAccessList?: {
|
|
74
|
+
chainId: number;
|
|
75
|
+
tokenAddress: Address;
|
|
76
|
+
}[];
|
|
77
|
+
omniLock?: boolean;
|
|
78
|
+
}
|
|
79
|
+
export type MetaIntentEmpty = MetaIntentBase & WithoutOperation;
|
|
80
|
+
export type MetaIntentWithUserOp = MetaIntentBase & WithUserOp;
|
|
81
|
+
export type MetaIntentWithExecutions = MetaIntentBase & WithExecutions;
|
|
82
|
+
export type MetaIntent = MetaIntentEmpty | MetaIntentWithUserOp | MetaIntentWithExecutions;
|
|
83
|
+
type ChainExecution = Execution & {
|
|
84
|
+
chainId: number;
|
|
85
|
+
};
|
|
86
|
+
interface DepositEvent {
|
|
87
|
+
originClaimPayload: ChainExecution;
|
|
88
|
+
inputToken: Address;
|
|
89
|
+
outputToken: Address;
|
|
90
|
+
inputAmount: bigint;
|
|
91
|
+
outputAmount: bigint;
|
|
92
|
+
destinationChainId: number;
|
|
93
|
+
originChainId: number;
|
|
94
|
+
depositId: bigint;
|
|
95
|
+
quoteTimestamp: number;
|
|
96
|
+
fillDeadline: number;
|
|
97
|
+
exclusivityDeadline: number;
|
|
98
|
+
depositor: Address;
|
|
99
|
+
recipient: Address;
|
|
100
|
+
exclusiveRelayer: Address;
|
|
101
|
+
message: Hex;
|
|
102
|
+
}
|
|
103
|
+
export interface BundleEvent {
|
|
104
|
+
bundleId: bigint;
|
|
105
|
+
type: string;
|
|
106
|
+
targetFillPayload: ChainExecution;
|
|
107
|
+
acrossDepositEvents: DepositEvent[];
|
|
108
|
+
}
|
|
109
|
+
export interface Witness {
|
|
110
|
+
recipient: Address;
|
|
111
|
+
tokenOut: [bigint, bigint][];
|
|
112
|
+
depositId: bigint;
|
|
113
|
+
targetChain: bigint;
|
|
114
|
+
fillDeadline: number;
|
|
115
|
+
execs: Execution[];
|
|
116
|
+
userOpHash: Hex;
|
|
117
|
+
maxFeeBps: number;
|
|
118
|
+
}
|
|
119
|
+
export interface Segment {
|
|
120
|
+
arbiter: Address;
|
|
121
|
+
chainId: bigint;
|
|
122
|
+
idsAndAmounts: [bigint, bigint][];
|
|
123
|
+
witness: Witness;
|
|
124
|
+
}
|
|
125
|
+
export interface MultiChainCompact {
|
|
126
|
+
sponsor: Address;
|
|
127
|
+
nonce: bigint;
|
|
128
|
+
expires: bigint;
|
|
129
|
+
segments: Segment[];
|
|
130
|
+
}
|
|
131
|
+
export interface SignedMultiChainCompact extends MultiChainCompact {
|
|
132
|
+
originSignatures: Hex[];
|
|
133
|
+
targetSignature: Hex;
|
|
134
|
+
}
|
|
135
|
+
export interface UserTokenBalance {
|
|
136
|
+
tokenName: string;
|
|
137
|
+
tokenDecimals: number;
|
|
138
|
+
balance: bigint;
|
|
139
|
+
tokenChainBalance: {
|
|
140
|
+
chainId: number;
|
|
141
|
+
tokenAddress: Address;
|
|
142
|
+
balance: bigint;
|
|
143
|
+
}[];
|
|
144
|
+
}
|
|
145
|
+
export type TokenArrays6909 = readonly (readonly [bigint, bigint])[];
|
|
146
|
+
export {};
|
|
147
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../services/orchestrator/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EACL,OAAO,EACP,WAAW,EACX,eAAe,EACf,eAAe,EACf,WAAW,EACX,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,OAAO,EACR,MAAM,aAAa,CAAA;AAEpB,KAAK,gBAAgB,GACjB,OAAO,OAAO,CAAC,EAAE,GACjB,OAAO,WAAW,CAAC,EAAE,GACrB,OAAO,eAAe,CAAC,EAAE,GACzB,OAAO,eAAe,CAAC,EAAE,GACzB,OAAO,WAAW,CAAC,EAAE,CAAA;AACzB,KAAK,gBAAgB,GACjB,OAAO,OAAO,CAAC,EAAE,GACjB,OAAO,IAAI,CAAC,EAAE,GACd,OAAO,QAAQ,CAAC,EAAE,GAClB,OAAO,QAAQ,CAAC,EAAE,GAClB,OAAO,OAAO,CAAC,EAAE,CAAA;AACrB,MAAM,MAAM,cAAc,GAAG,gBAAgB,GAAG,gBAAgB,CAAA;AAEhE,eAAO,MAAM,qBAAqB,YAAY,CAAA;AAC9C,eAAO,MAAM,oBA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B,EAAE,GAAG,EAAE,CAAA;IACvB,eAAe,EAAE,GAAG,CAAA;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,OAAO,EAAE,MAAM,CAAA;IACf,iBAAiB,EAAE;QACjB,OAAO,EAAE,MAAM,CAAA;QACf,YAAY,EAAE,OAAO,CAAA;QACrB,OAAO,EAAE,MAAM,CAAA;KAChB,EAAE,CAAA;CACJ;AAED,MAAM,MAAM,eAAe,GAAG,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const BUNDLE_STATUS_PENDING = 'PENDING';
|
|
2
|
+
export const BUNDLE_STATUS_FAILED = 'FAILED';
|
|
3
|
+
export const BUNDLE_STATUS_EXPIRED = 'EXPIRED';
|
|
4
|
+
export const BUNDLE_STATUS_PARTIALLY_COMPLETED = 'PARTIALLY_COMPLETED';
|
|
5
|
+
export const BUNDLE_STATUS_COMPLETED = 'COMPLETED';
|
|
6
|
+
export const BUNDLE_STATUS_UNKNOWN = 'UNKNOWN';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Hex } from 'viem';
|
|
2
|
+
import { BundleEvent, MultiChainCompact } from './types';
|
|
3
|
+
export declare function getOrderBundleHash(orderBundle: MultiChainCompact): Hex;
|
|
4
|
+
export declare function convertBigIntFields(obj: any): any;
|
|
5
|
+
export declare function parseCompactResponse(response: any): MultiChainCompact;
|
|
6
|
+
export declare function parsePendingBundleEvent(response: any): BundleEvent;
|
|
7
|
+
//# sourceMappingURL=utils.d.ts.map
|