@spritz-finance/service-client 0.20.0 → 0.22.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/lib/web3/types.d.ts
CHANGED
|
@@ -116,6 +116,7 @@ export type ListListedKaminoVaultIdsResponse = {
|
|
|
116
116
|
export type UserOpsSigner = {
|
|
117
117
|
id: string;
|
|
118
118
|
userId: string;
|
|
119
|
+
walletId?: string;
|
|
119
120
|
curve: string;
|
|
120
121
|
pathFormat: string;
|
|
121
122
|
seedIndex: number;
|
|
@@ -126,5 +127,15 @@ export type UserOpsSigner = {
|
|
|
126
127
|
entryPointVersion: string;
|
|
127
128
|
};
|
|
128
129
|
address: string;
|
|
130
|
+
stagedAt?: string;
|
|
131
|
+
retiredAt?: string;
|
|
129
132
|
createdAt: string;
|
|
130
133
|
};
|
|
134
|
+
export type OpsSignerMigrationState = {
|
|
135
|
+
requiresMigration: boolean;
|
|
136
|
+
sourceSigner: UserOpsSigner;
|
|
137
|
+
targetSigner?: UserOpsSigner;
|
|
138
|
+
};
|
|
139
|
+
export type OpsSignerReplacement = OpsSignerMigrationState & {
|
|
140
|
+
targetSigner: UserOpsSigner;
|
|
141
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * as Web3Client from "./web3ServiceClient";
|
|
2
|
-
import { ExactInQuoteInput, ExactInQuoteResponse, ListListedKaminoVaultIdsInput, ListListedKaminoVaultIdsResponse, OpsSignerType, Portfolio, SignerUsageType, SolanaPaymentBuildInput, SolanaPaymentBuildResult, TokenBalance, UserOpsSigner, WalletTokenBalanceInput } from "./types";
|
|
2
|
+
import { ExactInQuoteInput, ExactInQuoteResponse, ListListedKaminoVaultIdsInput, ListListedKaminoVaultIdsResponse, OpsSignerMigrationState, OpsSignerReplacement, OpsSignerType, Portfolio, SignerUsageType, SolanaPaymentBuildInput, SolanaPaymentBuildResult, TokenBalance, UserOpsSigner, WalletTokenBalanceInput } from "./types";
|
|
3
3
|
export declare function getExactInQuote(input: ExactInQuoteInput): Promise<ExactInQuoteResponse>;
|
|
4
4
|
export declare function getTokenBalances(input: WalletTokenBalanceInput): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<TokenBalance[]>>;
|
|
5
5
|
export declare function getPortfolio(address: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<Portfolio>>;
|
|
@@ -14,8 +14,28 @@ export declare function getSmartAccountAddress(input: {
|
|
|
14
14
|
userId: string;
|
|
15
15
|
usageType: SignerUsageType;
|
|
16
16
|
}): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<`0x${string}`>>;
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Provisions the user's signer for `signerType` if they do not already have one
|
|
19
|
+
* and returns it. Turnkey bills per derived address, so signers are minted
|
|
20
|
+
* just-in-time by the first flow that needs one rather than at KYC — call this
|
|
21
|
+
* instead of `getUserOpsSigner` anywhere a missing signer should be created.
|
|
22
|
+
*/
|
|
23
|
+
export declare function ensureUserOpsSigner(input: {
|
|
18
24
|
userId: string;
|
|
19
|
-
|
|
25
|
+
signerType: OpsSignerType;
|
|
26
|
+
}): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<UserOpsSigner>>;
|
|
27
|
+
/**
|
|
28
|
+
* Creates an inactive signer in the current ops wallet for a legacy user. The
|
|
29
|
+
* existing signer remains active until its consumer completes the external
|
|
30
|
+
* authorisation cutover.
|
|
31
|
+
*/
|
|
32
|
+
export declare function stageUserOpsSignerReplacement(input: {
|
|
33
|
+
userId: string;
|
|
34
|
+
signerType: OpsSignerType;
|
|
35
|
+
}): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<OpsSignerReplacement>>;
|
|
36
|
+
export declare function getUserOpsSignerReplacement(input: {
|
|
37
|
+
userId: string;
|
|
38
|
+
signerType: OpsSignerType;
|
|
39
|
+
}): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<OpsSignerMigrationState>>;
|
|
20
40
|
export declare function buildSolanaPayment(input: SolanaPaymentBuildInput): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<SolanaPaymentBuildResult>>;
|
|
21
41
|
export declare function listListedKaminoVaultIds(input?: ListListedKaminoVaultIdsInput): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<ListListedKaminoVaultIdsResponse>>;
|
|
@@ -40,7 +40,9 @@ exports.getPortfolio = getPortfolio;
|
|
|
40
40
|
exports.getUserOpsSigner = getUserOpsSigner;
|
|
41
41
|
exports.getUserOpsSignerByAddress = getUserOpsSignerByAddress;
|
|
42
42
|
exports.getSmartAccountAddress = getSmartAccountAddress;
|
|
43
|
-
exports.
|
|
43
|
+
exports.ensureUserOpsSigner = ensureUserOpsSigner;
|
|
44
|
+
exports.stageUserOpsSignerReplacement = stageUserOpsSignerReplacement;
|
|
45
|
+
exports.getUserOpsSignerReplacement = getUserOpsSignerReplacement;
|
|
44
46
|
exports.buildSolanaPayment = buildSolanaPayment;
|
|
45
47
|
exports.listListedKaminoVaultIds = listListedKaminoVaultIds;
|
|
46
48
|
exports.Web3Client = __importStar(require("./web3ServiceClient"));
|
|
@@ -77,9 +79,30 @@ async function getSmartAccountAddress(input) {
|
|
|
77
79
|
.get(`${WEB3_ENDPOINT}/ops-signer/smart-account/${input.userId}?usageType=${input.usageType}`)
|
|
78
80
|
.then((res) => res.data);
|
|
79
81
|
}
|
|
80
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Provisions the user's signer for `signerType` if they do not already have one
|
|
84
|
+
* and returns it. Turnkey bills per derived address, so signers are minted
|
|
85
|
+
* just-in-time by the first flow that needs one rather than at KYC — call this
|
|
86
|
+
* instead of `getUserOpsSigner` anywhere a missing signer should be created.
|
|
87
|
+
*/
|
|
88
|
+
async function ensureUserOpsSigner(input) {
|
|
81
89
|
return serviceClient_1.baseClient
|
|
82
|
-
.post(`${WEB3_ENDPOINT}/ops-signer/user/${input.userId}`)
|
|
90
|
+
.post(`${WEB3_ENDPOINT}/ops-signer/user/${input.userId}?signerType=${input.signerType}`)
|
|
91
|
+
.then((res) => res.data);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Creates an inactive signer in the current ops wallet for a legacy user. The
|
|
95
|
+
* existing signer remains active until its consumer completes the external
|
|
96
|
+
* authorisation cutover.
|
|
97
|
+
*/
|
|
98
|
+
async function stageUserOpsSignerReplacement(input) {
|
|
99
|
+
return serviceClient_1.baseClient
|
|
100
|
+
.post(`${WEB3_V2_ENDPOINT}/ops-signers/${input.userId}/replacement?signerType=${input.signerType}`)
|
|
101
|
+
.then((res) => res.data);
|
|
102
|
+
}
|
|
103
|
+
async function getUserOpsSignerReplacement(input) {
|
|
104
|
+
return serviceClient_1.baseClient
|
|
105
|
+
.get(`${WEB3_V2_ENDPOINT}/ops-signers/${input.userId}/replacement?signerType=${input.signerType}`)
|
|
83
106
|
.then((res) => res.data);
|
|
84
107
|
}
|
|
85
108
|
async function buildSolanaPayment(input) {
|