@spritz-finance/service-client 0.7.2 → 0.8.1
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
|
@@ -47,7 +47,8 @@ export type Portfolio = {
|
|
|
47
47
|
};
|
|
48
48
|
export declare enum SignerUsageType {
|
|
49
49
|
BRIDGE_TRANSFER = 0,
|
|
50
|
-
RAIN_TRANSFER = 1
|
|
50
|
+
RAIN_TRANSFER = 1,
|
|
51
|
+
ONRAMP_PURCHASE = 2
|
|
51
52
|
}
|
|
52
53
|
export declare enum OpsSignerType {
|
|
53
54
|
Evm = "ADDRESS_FORMAT_ETHEREUM",
|
|
@@ -56,6 +57,55 @@ export declare enum OpsSignerType {
|
|
|
56
57
|
Tron = "ADDRESS_FORMAT_TRON",
|
|
57
58
|
Sui = "ADDRESS_FORMAT_SUI"
|
|
58
59
|
}
|
|
60
|
+
export type SolanaPaymentBuildInput = {
|
|
61
|
+
directPaymentId: string;
|
|
62
|
+
userId: string;
|
|
63
|
+
senderAddress: string;
|
|
64
|
+
feePayer?: string;
|
|
65
|
+
};
|
|
66
|
+
export type SolanaInstructionAccount = {
|
|
67
|
+
pubkey: string;
|
|
68
|
+
isSigner: boolean;
|
|
69
|
+
isWritable: boolean;
|
|
70
|
+
};
|
|
71
|
+
export type SolanaInstruction = {
|
|
72
|
+
programId: string;
|
|
73
|
+
keys: SolanaInstructionAccount[];
|
|
74
|
+
data: string;
|
|
75
|
+
};
|
|
76
|
+
export type SolanaAddressLookupTableAccountData = {
|
|
77
|
+
address: string;
|
|
78
|
+
addresses: string[];
|
|
79
|
+
};
|
|
80
|
+
export type SolanaPaymentBuildSummary = {
|
|
81
|
+
kind: "payment";
|
|
82
|
+
title: string;
|
|
83
|
+
from: string;
|
|
84
|
+
to: string;
|
|
85
|
+
amount: string;
|
|
86
|
+
mint: string;
|
|
87
|
+
tokenSymbol: string;
|
|
88
|
+
directPaymentId: string;
|
|
89
|
+
};
|
|
90
|
+
export type SolanaPaymentBuildResult = {
|
|
91
|
+
type: "solana_payment_build";
|
|
92
|
+
chain: "solana";
|
|
93
|
+
directPaymentId: string;
|
|
94
|
+
userId: string;
|
|
95
|
+
userSigner: string;
|
|
96
|
+
feePayer: string;
|
|
97
|
+
inputMint: string;
|
|
98
|
+
outputMint: string;
|
|
99
|
+
amount: string;
|
|
100
|
+
requiredTokenInput: string;
|
|
101
|
+
destinationAddress: string;
|
|
102
|
+
reference: string;
|
|
103
|
+
recentBlockhash: string;
|
|
104
|
+
lastValidBlockHeight: number;
|
|
105
|
+
instructions: SolanaInstruction[];
|
|
106
|
+
addressLookupTableAccounts: SolanaAddressLookupTableAccountData[];
|
|
107
|
+
summary: SolanaPaymentBuildSummary;
|
|
108
|
+
};
|
|
59
109
|
export type UserOpsSigner = {
|
|
60
110
|
id: string;
|
|
61
111
|
userId: string;
|
package/lib/web3/types.js
CHANGED
|
@@ -5,6 +5,7 @@ var SignerUsageType;
|
|
|
5
5
|
(function (SignerUsageType) {
|
|
6
6
|
SignerUsageType[SignerUsageType["BRIDGE_TRANSFER"] = 0] = "BRIDGE_TRANSFER";
|
|
7
7
|
SignerUsageType[SignerUsageType["RAIN_TRANSFER"] = 1] = "RAIN_TRANSFER";
|
|
8
|
+
SignerUsageType[SignerUsageType["ONRAMP_PURCHASE"] = 2] = "ONRAMP_PURCHASE";
|
|
8
9
|
})(SignerUsageType || (exports.SignerUsageType = SignerUsageType = {}));
|
|
9
10
|
var OpsSignerType;
|
|
10
11
|
(function (OpsSignerType) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * as Web3Client from "./web3ServiceClient";
|
|
2
|
-
import { ExactInQuoteInput, ExactInQuoteResponse, OpsSignerType, Portfolio, SignerUsageType, TokenBalance, UserOpsSigner, WalletTokenBalanceInput } from "./types";
|
|
2
|
+
import { ExactInQuoteInput, ExactInQuoteResponse, 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>>;
|
|
@@ -17,3 +17,4 @@ export declare function getSmartAccountAddress(input: {
|
|
|
17
17
|
export declare function createUserOpsSigner(input: {
|
|
18
18
|
userId: string;
|
|
19
19
|
}): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<boolean>>;
|
|
20
|
+
export declare function buildSolanaPayment(input: SolanaPaymentBuildInput): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<SolanaPaymentBuildResult>>;
|
|
@@ -41,9 +41,11 @@ exports.getUserOpsSigner = getUserOpsSigner;
|
|
|
41
41
|
exports.getUserOpsSignerByAddress = getUserOpsSignerByAddress;
|
|
42
42
|
exports.getSmartAccountAddress = getSmartAccountAddress;
|
|
43
43
|
exports.createUserOpsSigner = createUserOpsSigner;
|
|
44
|
+
exports.buildSolanaPayment = buildSolanaPayment;
|
|
44
45
|
exports.Web3Client = __importStar(require("./web3ServiceClient"));
|
|
45
46
|
const serviceClient_1 = require("../serviceClient");
|
|
46
47
|
const WEB3_ENDPOINT = "/web3";
|
|
48
|
+
const WEB3_V2_ENDPOINT = "/v2/web3/api";
|
|
47
49
|
async function getExactInQuote(input) {
|
|
48
50
|
return serviceClient_1.baseClient
|
|
49
51
|
.post(`${WEB3_ENDPOINT}/quote/swap/exactIn`, input)
|
|
@@ -79,3 +81,8 @@ async function createUserOpsSigner(input) {
|
|
|
79
81
|
.post(`${WEB3_ENDPOINT}/ops-signer/user/${input.userId}`)
|
|
80
82
|
.then((res) => res.data);
|
|
81
83
|
}
|
|
84
|
+
async function buildSolanaPayment(input) {
|
|
85
|
+
return serviceClient_1.baseClient
|
|
86
|
+
.post(`${WEB3_V2_ENDPOINT}/solana-payment/build`, input)
|
|
87
|
+
.then((res) => res.data);
|
|
88
|
+
}
|