@rhinestone/sdk 2.2.1 → 2.2.2
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/actions/mfa.d.ts +0 -1
- package/dist/src/actions/mfa.d.ts.map +1 -1
- package/dist/src/actions/mfa.js +0 -1
- package/dist/src/actions/passkeys.d.ts +1 -2
- package/dist/src/actions/passkeys.d.ts.map +1 -1
- package/dist/src/actions/passkeys.js +1 -2
- package/dist/src/api/sdk.d.ts +1 -1
- package/dist/src/api/sdk.js +1 -1
- package/dist/src/chains/caip2.d.ts +15 -0
- package/dist/src/chains/caip2.d.ts.map +1 -1
- package/dist/src/chains/caip2.js +34 -6
- package/dist/src/chains/catalog.js +2 -2
- package/dist/src/chains/non-evm.d.ts +4 -3
- package/dist/src/chains/non-evm.d.ts.map +1 -1
- package/dist/src/chains/non-evm.js +17 -4
- package/dist/src/clients/orchestrator/client.js +1 -1
- package/dist/src/config/account.d.ts +3 -3
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -2
- package/dist/src/transactions/intents/prepare.d.ts.map +1 -1
- package/dist/src/transactions/intents/prepare.js +16 -3
- package/dist/src/transactions/intents/sessions.d.ts.map +1 -1
- package/dist/src/transactions/intents/sessions.js +12 -1
- package/package.json +1 -1
|
@@ -15,7 +15,6 @@ declare function enable(validators: (OwnableValidatorConfig | WebauthnValidatorC
|
|
|
15
15
|
declare function changeThreshold(newThreshold: number): CalldataInput;
|
|
16
16
|
/**
|
|
17
17
|
* Disable multi-factor authentication
|
|
18
|
-
* @param rhinestoneAccount Account to disable multi-factor authentication on
|
|
19
18
|
* @returns Calls to disable multi-factor authentication
|
|
20
19
|
*/
|
|
21
20
|
declare function disable(): LazyCallInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mfa.d.ts","sourceRoot":"","sources":["../../../actions/mfa.ts"],"names":[],"mappings":"AAAA,OAAO,EAA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fa.js
CHANGED
|
@@ -61,7 +61,6 @@ function changeThreshold(newThreshold) {
|
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
63
|
* Disable multi-factor authentication
|
|
64
|
-
* @param rhinestoneAccount Account to disable multi-factor authentication on
|
|
65
64
|
* @returns Calls to disable multi-factor authentication
|
|
66
65
|
*/
|
|
67
66
|
function disable() {
|
|
@@ -2,8 +2,7 @@ import type { CalldataInput, LazyCallInput } from '../config/account.js';
|
|
|
2
2
|
import { type WebauthnCredential } from '../modules/validators/webauthn.js';
|
|
3
3
|
/**
|
|
4
4
|
* Enable passkeys authentication
|
|
5
|
-
* @param
|
|
6
|
-
* @param authenticatorId Authenticator ID for the passkey
|
|
5
|
+
* @param credential WebAuthn credential to enable
|
|
7
6
|
* @returns Calls to enable passkeys authentication
|
|
8
7
|
*/
|
|
9
8
|
declare function enable(credential: WebauthnCredential): LazyCallInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"passkeys.d.ts","sourceRoot":"","sources":["../../../actions/passkeys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACrE,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,gCAAgC,CAAA;AAWvC
|
|
1
|
+
{"version":3,"file":"passkeys.d.ts","sourceRoot":"","sources":["../../../actions/passkeys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACrE,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,gCAAgC,CAAA;AAWvC;;;;GAIG;AACH,iBAAS,MAAM,CAAC,UAAU,EAAE,kBAAkB,GAAG,aAAa,CAU7D;AAED;;;GAGG;AACH,iBAAS,OAAO,IAAI,aAAa,CAgBhC;AAED;;;;;;GAMG;AACH,iBAAS,QAAQ,CACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,uBAAuB,EAAE,OAAO,GAC/B,aAAa,CAOf;AAED;;;;;GAKG;AACH,iBAAS,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,aAAa,CAEpE;AAED;;;;GAIG;AACH,iBAAS,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,aAAa,CAE5D;AAED,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,CAAA"}
|
|
@@ -3,8 +3,7 @@ import { resolveModuleInstallation, resolveModuleUninstallation, } from './runti
|
|
|
3
3
|
import { addWebauthnCredential, changeWebauthnThreshold, removeWebauthnCredential, } from './webauthn.js';
|
|
4
4
|
/**
|
|
5
5
|
* Enable passkeys authentication
|
|
6
|
-
* @param
|
|
7
|
-
* @param authenticatorId Authenticator ID for the passkey
|
|
6
|
+
* @param credential WebAuthn credential to enable
|
|
8
7
|
* @returns Calls to enable passkeys authentication
|
|
9
8
|
*/
|
|
10
9
|
function enable(credential) {
|
package/dist/src/api/sdk.d.ts
CHANGED
|
@@ -69,7 +69,7 @@ declare class RhinestoneSDK {
|
|
|
69
69
|
* Create a smart session, resolving the chain's wrapped-native token from the
|
|
70
70
|
* orchestrator's chain catalog (`GET /chains`) so native-token wrapping is
|
|
71
71
|
* permitted automatically. Project-scoped — needs the API key but no account.
|
|
72
|
-
* For a fully offline build, use the standalone
|
|
72
|
+
* For a fully offline build, use the standalone `toSession` and pass
|
|
73
73
|
* `wrappedNativeToken` yourself.
|
|
74
74
|
* @param definition The session definition
|
|
75
75
|
* @returns The resolved session
|
package/dist/src/api/sdk.js
CHANGED
|
@@ -91,7 +91,7 @@ class RhinestoneSDK {
|
|
|
91
91
|
* Create a smart session, resolving the chain's wrapped-native token from the
|
|
92
92
|
* orchestrator's chain catalog (`GET /chains`) so native-token wrapping is
|
|
93
93
|
* permitted automatically. Project-scoped — needs the API key but no account.
|
|
94
|
-
* For a fully offline build, use the standalone
|
|
94
|
+
* For a fully offline build, use the standalone `toSession` and pass
|
|
95
95
|
* `wrappedNativeToken` yourself.
|
|
96
96
|
* @param definition The session definition
|
|
97
97
|
* @returns The resolved session
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
import type { ChainReference, EvmChainReference } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* True when a chain id's wire form is in the `hypercore:` namespace.
|
|
4
|
+
*
|
|
5
|
+
* This is the one combination the `caip2.startsWith('eip155:')` test gets wrong:
|
|
6
|
+
* HyperCore is EVM-*addressed* (hex recipients, EIP-712 signing) while its wire
|
|
7
|
+
* id is not `eip155:`, so every place that decides "is this reference EVM" must
|
|
8
|
+
* ask this too. Two places did it as `chainId === 1337`, which silently became
|
|
9
|
+
* wrong the moment HyperCore gained a second id — derived from the table here so
|
|
10
|
+
* a third venue cannot reintroduce it.
|
|
11
|
+
*
|
|
12
|
+
* NOT the same as `isHyperCoreChainId` in `@rhinestone/shared-configs`, which
|
|
13
|
+
* answers "is this a delivery VENUE" and is deliberately false for the Core L1.
|
|
14
|
+
* This one is about address shape, so it is true for all three.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isHyperCoreWireId(chainId: number): boolean;
|
|
2
17
|
export declare function formatCaip2(chainId: number): string;
|
|
3
18
|
export declare function chainIdFromCaip2(value: string): number | undefined;
|
|
4
19
|
export declare function parseCaip2(value: string): ChainReference;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"caip2.d.ts","sourceRoot":"","sources":["../../../chains/caip2.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"caip2.d.ts","sourceRoot":"","sources":["../../../chains/caip2.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AA0ChE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAE1D;AAID,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAMnD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKlE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,CAmBxD;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB,CAUtE;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAOlE;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE9C;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,UAAU,MAAM,EAAE,CAErE;AAKD,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAExD"}
|
package/dist/src/chains/caip2.js
CHANGED
|
@@ -4,12 +4,22 @@
|
|
|
4
4
|
// v2: this small table is bundled here rather than read from
|
|
5
5
|
// `@rhinestone/shared-configs`. EVM is the common case and needs no table, so a
|
|
6
6
|
// new EVM chain needs no SDK change; a new non-EVM chain is rare and adds one
|
|
7
|
-
// entry below. HyperCore is EVM
|
|
8
|
-
// `false` for
|
|
7
|
+
// entry below. Every HyperCore id is EVM-*settled*, so `isNonEvmChainId` is
|
|
8
|
+
// `false` for all of them even though their wire ids are the non-`eip155`
|
|
9
|
+
// `hypercore:` namespace.
|
|
10
|
+
//
|
|
11
|
+
// This table is TRANSLATION, not policy: it answers "what number is this wire
|
|
12
|
+
// id", and adding an entry does not make that chain a legal destination. Which
|
|
13
|
+
// HyperCore ids you may TARGET is `HyperCoreCaip2ChainId` and the exported
|
|
14
|
+
// descriptors — only the two venues. `hypercore:mainnet` is here because it is a
|
|
15
|
+
// real chain (the Core L1, where deposits originate) that can appear in a
|
|
16
|
+
// response we have to parse; it is not an addressable target (RHI-5510).
|
|
9
17
|
//
|
|
10
18
|
// Spec: https://chainagnostic.org/CAIPs/caip-2
|
|
11
19
|
const NON_EVM_CHAINS = [
|
|
12
20
|
{ id: 1337, caip2: 'hypercore:mainnet', nonEvm: false },
|
|
21
|
+
{ id: 1337001, caip2: 'hypercore:spot', nonEvm: false },
|
|
22
|
+
{ id: 1337002, caip2: 'hypercore:perp', nonEvm: false },
|
|
13
23
|
{ id: 728126428, caip2: 'tron:mainnet', nonEvm: true },
|
|
14
24
|
{
|
|
15
25
|
id: 792703809,
|
|
@@ -17,6 +27,24 @@ const NON_EVM_CHAINS = [
|
|
|
17
27
|
nonEvm: true,
|
|
18
28
|
},
|
|
19
29
|
];
|
|
30
|
+
const HYPERCORE_WIRE_IDS = new Set(NON_EVM_CHAINS.filter((chain) => chain.caip2.startsWith('hypercore:')).map((chain) => chain.id));
|
|
31
|
+
/**
|
|
32
|
+
* True when a chain id's wire form is in the `hypercore:` namespace.
|
|
33
|
+
*
|
|
34
|
+
* This is the one combination the `caip2.startsWith('eip155:')` test gets wrong:
|
|
35
|
+
* HyperCore is EVM-*addressed* (hex recipients, EIP-712 signing) while its wire
|
|
36
|
+
* id is not `eip155:`, so every place that decides "is this reference EVM" must
|
|
37
|
+
* ask this too. Two places did it as `chainId === 1337`, which silently became
|
|
38
|
+
* wrong the moment HyperCore gained a second id — derived from the table here so
|
|
39
|
+
* a third venue cannot reintroduce it.
|
|
40
|
+
*
|
|
41
|
+
* NOT the same as `isHyperCoreChainId` in `@rhinestone/shared-configs`, which
|
|
42
|
+
* answers "is this a delivery VENUE" and is deliberately false for the Core L1.
|
|
43
|
+
* This one is about address shape, so it is true for all three.
|
|
44
|
+
*/
|
|
45
|
+
export function isHyperCoreWireId(chainId) {
|
|
46
|
+
return HYPERCORE_WIRE_IDS.has(chainId);
|
|
47
|
+
}
|
|
20
48
|
const evmPattern = /^eip155:(0|[1-9]\d*)$/;
|
|
21
49
|
export function formatCaip2(chainId) {
|
|
22
50
|
if (!Number.isSafeInteger(chainId) || chainId < 0) {
|
|
@@ -53,7 +81,7 @@ export function parseCaip2(value) {
|
|
|
53
81
|
}
|
|
54
82
|
export function toEvmChainReference(chainId) {
|
|
55
83
|
const caip2 = formatCaip2(chainId);
|
|
56
|
-
if (!caip2.startsWith('eip155:') && chainId
|
|
84
|
+
if (!caip2.startsWith('eip155:') && !isHyperCoreWireId(chainId)) {
|
|
57
85
|
throw new Error(`Chain ${chainId} is not EVM-compatible`);
|
|
58
86
|
}
|
|
59
87
|
return {
|
|
@@ -77,9 +105,9 @@ export function isCaip2(value) {
|
|
|
77
105
|
export function isEvmCaip2(value) {
|
|
78
106
|
return evmPattern.test(value);
|
|
79
107
|
}
|
|
80
|
-
// True when a numeric chain id is genuinely non-EVM (Solana / Tron).
|
|
81
|
-
//
|
|
82
|
-
// the non-`eip155` `hypercore
|
|
108
|
+
// True when a numeric chain id is genuinely non-EVM (Solana / Tron). Every
|
|
109
|
+
// HyperCore id is EVM-settled, so this is `false` for all of them even though
|
|
110
|
+
// their wire ids are in the non-`eip155` `hypercore:` namespace.
|
|
83
111
|
export function isNonEvmChainId(chainId) {
|
|
84
112
|
return NON_EVM_CHAINS.some((chain) => chain.id === chainId && chain.nonEvm);
|
|
85
113
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineChain } from 'viem';
|
|
2
2
|
import * as viemChains from 'viem/chains';
|
|
3
|
-
import { formatCaip2 } from './caip2.js';
|
|
3
|
+
import { formatCaip2, isHyperCoreWireId } from './caip2.js';
|
|
4
4
|
// Chain objects (rpc / nativeCurrency / formatters, needed for signing and
|
|
5
5
|
// `createPublicClient`) come from viem — not from bundled chain config. The
|
|
6
6
|
// supported *set* is gated by the orchestrator; this resolves any known viem
|
|
@@ -24,7 +24,7 @@ export function getChainById(chainId) {
|
|
|
24
24
|
}
|
|
25
25
|
export function getChainReference(chainId) {
|
|
26
26
|
const caip2 = formatCaip2(chainId);
|
|
27
|
-
if (caip2.startsWith('eip155:') || chainId
|
|
27
|
+
if (caip2.startsWith('eip155:') || isHyperCoreWireId(chainId)) {
|
|
28
28
|
return {
|
|
29
29
|
kind: 'evm',
|
|
30
30
|
id: chainId,
|
|
@@ -2,7 +2,7 @@ import type { Chain } from 'viem';
|
|
|
2
2
|
type EvmCaip2ChainId = `eip155:${number}`;
|
|
3
3
|
type SolanaCaip2ChainId = `solana:${string}`;
|
|
4
4
|
type TronCaip2ChainId = `tron:${string}`;
|
|
5
|
-
type HyperCoreCaip2ChainId = 'hypercore:
|
|
5
|
+
type HyperCoreCaip2ChainId = 'hypercore:spot' | 'hypercore:perp';
|
|
6
6
|
type Caip2ChainId = EvmCaip2ChainId | SolanaCaip2ChainId | TronCaip2ChainId | HyperCoreCaip2ChainId;
|
|
7
7
|
interface NativeCurrency {
|
|
8
8
|
readonly name: string;
|
|
@@ -20,7 +20,8 @@ interface NonEvmChain {
|
|
|
20
20
|
type DestinationChain = Chain | NonEvmChain;
|
|
21
21
|
declare const solanaMainnet: NonEvmChain;
|
|
22
22
|
declare const tronMainnet: NonEvmChain;
|
|
23
|
-
declare const
|
|
23
|
+
declare const hyperCoreSpot: NonEvmChain;
|
|
24
|
+
declare const hyperCorePerp: NonEvmChain;
|
|
24
25
|
export type { DestinationChain, NativeCurrency, NonEvmAddress, NonEvmChain };
|
|
25
|
-
export {
|
|
26
|
+
export { hyperCorePerp, hyperCoreSpot, solanaMainnet, tronMainnet };
|
|
26
27
|
//# sourceMappingURL=non-evm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"non-evm.d.ts","sourceRoot":"","sources":["../../../chains/non-evm.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,MAAM,CAAA;AAEjC,KAAK,eAAe,GAAG,UAAU,MAAM,EAAE,CAAA;AACzC,KAAK,kBAAkB,GAAG,UAAU,MAAM,EAAE,CAAA;AAC5C,KAAK,gBAAgB,GAAG,QAAQ,MAAM,EAAE,CAAA;
|
|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EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -21,10 +21,23 @@ const tronMainnet = {
|
|
|
21
21
|
kind: 'tvm',
|
|
22
22
|
nativeCurrency: { name: 'Tron', symbol: 'TRX', decimals: 6 },
|
|
23
23
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
// A HyperCore deposit credits one of two accounts that are not
|
|
25
|
+
// interchangeable: the recipient's spot wallet, or the default perp dex's
|
|
26
|
+
// margin account. `CoreDepositWallet.depositFor` selects between them, and the
|
|
27
|
+
// wrong choice is invisible — the intent completes, the fill succeeds, and only
|
|
28
|
+
// the recipient's Core state shows where the funds went. So the venue is the
|
|
29
|
+
// destination you address, not an optional field that four separate
|
|
30
|
+
// field-by-field rebuilds could each silently drop (RHI-5510).
|
|
31
|
+
const hyperCoreSpot = {
|
|
32
|
+
name: 'HyperCore Spot',
|
|
33
|
+
caip2: 'hypercore:spot',
|
|
27
34
|
kind: 'hypercore',
|
|
28
35
|
nativeCurrency: { name: 'Hyperliquid', symbol: 'HYPE', decimals: 18 },
|
|
29
36
|
};
|
|
30
|
-
|
|
37
|
+
const hyperCorePerp = {
|
|
38
|
+
name: 'HyperCore Perp',
|
|
39
|
+
caip2: 'hypercore:perp',
|
|
40
|
+
kind: 'hypercore',
|
|
41
|
+
nativeCurrency: { name: 'Hyperliquid', symbol: 'HYPE', decimals: 18 },
|
|
42
|
+
};
|
|
43
|
+
export { hyperCorePerp, hyperCoreSpot, solanaMainnet, tronMainnet };
|
|
@@ -3,7 +3,7 @@ import { createOrchestratorAuth } from './auth.js';
|
|
|
3
3
|
import { ChainCatalog, parseChains } from './chain-catalog.js';
|
|
4
4
|
import { fetchOrchestratorJson } from './fetch.js';
|
|
5
5
|
import { mapIntentRequestToWire, mapIntentStatusFromWire, mapPortfolioFromWire, mapQuoteResponseFromWire, mapSignedIntentToWire, mapSplitRequestToWire, mapSplitResultFromWire, } from './mappers.js';
|
|
6
|
-
const SDK_VERSION = '2.2.
|
|
6
|
+
const SDK_VERSION = '2.2.2';
|
|
7
7
|
const API_VERSION = '2026-04.blanc';
|
|
8
8
|
export function createOrchestratorClient(options) {
|
|
9
9
|
const fetchPort = options.fetch ?? globalThis.fetch;
|
|
@@ -195,7 +195,7 @@ type CrossChainSettlementLayer = 'SAME_CHAIN' | 'ECO' | 'ACROSS';
|
|
|
195
195
|
* A high-level permit that authorises a session key to move funds
|
|
196
196
|
* between two chains via Permit2 arbiter settlement. The SDK expands
|
|
197
197
|
* one `CrossChainPermit` into a {@link Permit2ClaimPolicy} (claim-side)
|
|
198
|
-
* plus optional
|
|
198
|
+
* plus optional `SpendingLimitsPolicy` / `TimeFramePolicy`
|
|
199
199
|
* entries on the fallback action — the claim policy itself doesn't
|
|
200
200
|
* enforce amounts or expiry on-chain, so we lift those guarantees into
|
|
201
201
|
* action-level policies that do.
|
|
@@ -265,7 +265,7 @@ interface ToLeg {
|
|
|
265
265
|
* addresses (v2 no longer accepts symbols) and the SDK resolves `Date`s to
|
|
266
266
|
* on-chain deadlines, then expands
|
|
267
267
|
* each entry into a {@link Permit2ClaimPolicy} (claim-side) plus optional
|
|
268
|
-
*
|
|
268
|
+
* `SpendingLimitsPolicy` / `TimeFramePolicy` guardrails.
|
|
269
269
|
*/
|
|
270
270
|
interface CrossChainPermissionInput {
|
|
271
271
|
/**
|
|
@@ -442,7 +442,7 @@ interface SessionDefinition<TAbis extends readonly Abi[] = readonly Abi[]> {
|
|
|
442
442
|
/**
|
|
443
443
|
* Cross-chain permits expanded by the SDK into matching
|
|
444
444
|
* {@link Permit2ClaimPolicy} (claim-side) plus action-level
|
|
445
|
-
*
|
|
445
|
+
* `SpendingLimitsPolicy` / `TimeFramePolicy` guardrails.
|
|
446
446
|
* See {@link CrossChainPermissionInput}.
|
|
447
447
|
*/
|
|
448
448
|
crossChainPermits?: readonly CrossChainPermissionInput[];
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { RhinestoneSDK } from './api/sdk.js';
|
|
2
|
-
import {
|
|
2
|
+
import { hyperCorePerp, hyperCoreSpot, solanaMainnet, tronMainnet } from './chains/non-evm.js';
|
|
3
3
|
import { MULTI_FACTOR_VALIDATOR_ADDRESS } from './modules/validators/multi-factor.js';
|
|
4
4
|
import { OWNABLE_VALIDATOR_ADDRESS } from './modules/validators/ownable.js';
|
|
5
5
|
import { SMART_SESSION_EMISSARY_ADDRESS } from './modules/validators/smart-sessions/module.js';
|
|
6
6
|
import { WEBAUTHN_VALIDATOR_ADDRESS } from './modules/validators/webauthn.js';
|
|
7
|
-
export { RhinestoneSDK,
|
|
7
|
+
export { RhinestoneSDK, hyperCorePerp, hyperCoreSpot, solanaMainnet, tronMainnet, OWNABLE_VALIDATOR_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS, MULTI_FACTOR_VALIDATOR_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS, };
|
|
8
8
|
export type { RhinestoneAccount, SignedIntentData } from './api/account.js';
|
|
9
9
|
export type { DestinationChain, NonEvmAddress, NonEvmChain, } from './chains/non-evm.js';
|
|
10
10
|
export type { AppFeeBalances, AppFeeRate, ApprovalRequired, AuxiliaryFunds, BridgeFill, ChainOperation, FailureReason, IntentInput, IntentOpStatus, OperationStatus, OriginSignature, Portfolio, ProtocolFeeRate, Quote, SerializedIntentInput, SettlementLayer, SettlementLayerFilter, SignData, SplitIntentsInput, SplitIntentsResult, TokenRequirements, WrapRequired, } from './clients/orchestrator/public.js';
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,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EACT,eAAe,EACf,uBAAuB,EACvB,YAAY,EACZ,WAAW,EACX,KAAK,EACL,WAAW,EACX,mCAAmC,EACnC,uBAAuB,GACxB,MAAM,kBAAkB,CAAA;AACzB,YAAY,EACV,qBAAqB,EACrB,cAAc,EACd,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,iBAAiB,CAAA;AACxB,YAAY,EACV,cAAc,EACd,uBAAuB,EACvB,cAAc,EACd,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,8BAA8B,CAAA;AACrC,YAAY,EACV,yBAAyB,EACzB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,sCAAsC,CAAA"}
|
package/dist/src/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { RhinestoneSDK } from './api/sdk.js';
|
|
2
|
-
import {
|
|
2
|
+
import { hyperCorePerp, hyperCoreSpot, solanaMainnet, tronMainnet, } from './chains/non-evm.js';
|
|
3
3
|
import { MULTI_FACTOR_VALIDATOR_ADDRESS } from './modules/validators/multi-factor.js';
|
|
4
4
|
import { OWNABLE_VALIDATOR_ADDRESS } from './modules/validators/ownable.js';
|
|
5
5
|
import { SMART_SESSION_EMISSARY_ADDRESS } from './modules/validators/smart-sessions/module.js';
|
|
6
6
|
import { WEBAUTHN_VALIDATOR_ADDRESS } from './modules/validators/webauthn.js';
|
|
7
7
|
export { RhinestoneSDK,
|
|
8
8
|
// Non-viem destination chain descriptors (Solana, Tron, HyperCore)
|
|
9
|
-
|
|
9
|
+
hyperCorePerp, hyperCoreSpot, solanaMainnet, tronMainnet,
|
|
10
10
|
// Validator addresses
|
|
11
11
|
OWNABLE_VALIDATOR_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS, MULTI_FACTOR_VALIDATOR_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepare.d.ts","sourceRoot":"","sources":["../../../../transactions/intents/prepare.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"prepare.d.ts","sourceRoot":"","sources":["../../../../transactions/intents/prepare.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAQ5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAI3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AAO1E,OAAO,KAAK,EACV,WAAW,EACX,qBAAqB,EACrB,cAAc,EACf,MAAM,SAAS,CAAA;AAEhB,wBAAsB,aAAa,CAAC,mBAAmB,EACrD,OAAO,EAAE,qBAAqB,CAAC,mBAAmB,CAAC,EACnD,KAAK,EAAE,WAAW,CAAC,mBAAmB,CAAC,GACtC,OAAO,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC,CA2D9C;AA8FD,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC,EAC9B,QAAQ,CAAC,EAAE,cAAc,CAAC,kBAAkB,CAAC,EAC7C,WAAW,CAAC,EAAE,iBAAiB,EAC/B,cAAc,CAAC,EAAE,OAAO,gCAAgC,EAAE,2BAA2B,EACrF,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,GACpC,kBAAkB,CA2IpB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { hashTypedData, keccak256, stringToHex } from 'viem';
|
|
2
2
|
import { resolveCalls } from '../../calls/resolve.js';
|
|
3
|
-
import { chainIdFromReference, toEvmChainReference } from '../../chains/caip2.js';
|
|
3
|
+
import { chainIdFromReference, isHyperCoreWireId, toEvmChainReference, } from '../../chains/caip2.js';
|
|
4
4
|
import { defineValidator } from '../../modules/validators/definition.js';
|
|
5
5
|
import { ecdsaSignerId } from '../../modules/validators/signer-id.js';
|
|
6
6
|
import { signingTopology } from '../../signing/plan.js';
|
|
@@ -59,12 +59,25 @@ export async function prepareIntent(context, input) {
|
|
|
59
59
|
: {}),
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
+
// The chain whose runtime hosts the account: identity, address derivation, and
|
|
63
|
+
// the RPC reads that follow. The destination serves when it is a real execution
|
|
64
|
+
// chain, and otherwise a source chain does.
|
|
65
|
+
//
|
|
66
|
+
// `kind === 'evm'` alone is not that test. HyperCore is EVM-ADDRESSED — hex
|
|
67
|
+
// recipients, EIP-712 — while being virtual: it has no RPC of its own and hosts
|
|
68
|
+
// no accounts, so materializing a runtime on it asks viem for a transport that
|
|
69
|
+
// cannot exist. That went unnoticed while HyperCore was chain 1337, because viem
|
|
70
|
+
// ships a `Localhost` chain with that exact id and quietly supplied
|
|
71
|
+
// `http://127.0.0.1:8545`; the venue ids have no viem chain, so the synthesised
|
|
72
|
+
// one has empty `rpcUrls` and the call fails with `UrlRequiredError` (RHI-5510).
|
|
62
73
|
function selectAccountChain(input) {
|
|
63
|
-
if (input.destination.kind === 'evm'
|
|
74
|
+
if (input.destination.kind === 'evm' &&
|
|
75
|
+
!isHyperCoreWireId(input.destination.id)) {
|
|
64
76
|
return input.destination;
|
|
77
|
+
}
|
|
65
78
|
const source = input.sourceChains?.at(-1);
|
|
66
79
|
if (!source) {
|
|
67
|
-
throw new Error(
|
|
80
|
+
throw new Error(`An intent to ${input.destination.caip2} requires at least one EVM source chain: the destination hosts no account runtime`);
|
|
68
81
|
}
|
|
69
82
|
return source;
|
|
70
83
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessions.d.ts","sourceRoot":"","sources":["../../../../transactions/intents/sessions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"sessions.d.ts","sourceRoot":"","sources":["../../../../transactions/intents/sessions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAQ7C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+CAA+C,CAAA;AAC7F,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEjE,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC,CAAA;IACpE,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAA;IACtD,QAAQ,CAAC,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC,CAAA;CAClE;AAED,wBAAsB,qBAAqB,CAAC,mBAAmB,EAAE,KAAK,EAAE;IACtE,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,mBAAmB,CAAC,CAAA;IACjD,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAA;IAChC,QAAQ,CAAC,OAAO,EAAE,IAAI,CACpB,qBAAqB,CAAC,mBAAmB,CAAC,EAC1C,aAAa,CACd,CAAA;CACF,GAAG,OAAO,CAAC,sBAAsB,GAAG,SAAS,CAAC,CAmF9C"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isHyperCoreWireId } from '../../chains/caip2.js';
|
|
1
2
|
import { buildSmartSessionMockSignature } from '../../modules/validators/smart-sessions/mock-signature.js';
|
|
2
3
|
import { DUMMY_PRECLAIMOP_SELECTOR, DUMMY_PRECLAIMOP_TARGET, } from '../../modules/validators/smart-sessions/resolve.js';
|
|
3
4
|
export async function prepareIntentSessions(input) {
|
|
@@ -76,9 +77,19 @@ export async function prepareIntentSessions(input) {
|
|
|
76
77
|
preClaimCalls,
|
|
77
78
|
};
|
|
78
79
|
}
|
|
80
|
+
// Chains a smart-session intent needs an enabled session on: every source, plus
|
|
81
|
+
// the destination when the user's own account executes there.
|
|
82
|
+
//
|
|
83
|
+
// A HyperCore venue is excluded for the same reason it cannot host the account
|
|
84
|
+
// runtime: it is EVM-ADDRESSED but virtual, so there is no account there to enable
|
|
85
|
+
// a session on, and requiring one would demand a session on chain 1337001/1337002
|
|
86
|
+
// that can never exist. Delivery is solver-mediated anyway — the orchestrator
|
|
87
|
+
// builds the `depositFor` credit and the recipient never executes — so there is no
|
|
88
|
+
// destination-side authorization for a session to grant (RHI-5510).
|
|
79
89
|
function sessionChains(intent) {
|
|
80
90
|
const chains = new Map((intent.sourceChains ?? []).map((chain) => [chain.id, chain]));
|
|
81
|
-
if (intent.destination.kind === 'evm'
|
|
91
|
+
if (intent.destination.kind === 'evm' &&
|
|
92
|
+
!isHyperCoreWireId(intent.destination.id)) {
|
|
82
93
|
chains.set(intent.destination.id, intent.destination);
|
|
83
94
|
}
|
|
84
95
|
return [...chains.values()];
|