@spritz-finance/service-client 0.7.2 → 0.8.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.
@@ -56,6 +56,55 @@ export declare enum OpsSignerType {
56
56
  Tron = "ADDRESS_FORMAT_TRON",
57
57
  Sui = "ADDRESS_FORMAT_SUI"
58
58
  }
59
+ export type SolanaPaymentBuildInput = {
60
+ directPaymentId: string;
61
+ userId: string;
62
+ senderAddress: string;
63
+ feePayer?: string;
64
+ };
65
+ export type SolanaInstructionAccount = {
66
+ pubkey: string;
67
+ isSigner: boolean;
68
+ isWritable: boolean;
69
+ };
70
+ export type SolanaInstruction = {
71
+ programId: string;
72
+ keys: SolanaInstructionAccount[];
73
+ data: string;
74
+ };
75
+ export type SolanaAddressLookupTableAccountData = {
76
+ address: string;
77
+ addresses: string[];
78
+ };
79
+ export type SolanaPaymentBuildSummary = {
80
+ kind: "payment";
81
+ title: string;
82
+ from: string;
83
+ to: string;
84
+ amount: string;
85
+ mint: string;
86
+ tokenSymbol: string;
87
+ directPaymentId: string;
88
+ };
89
+ export type SolanaPaymentBuildResult = {
90
+ type: "solana_payment_build";
91
+ chain: "solana";
92
+ directPaymentId: string;
93
+ userId: string;
94
+ userSigner: string;
95
+ feePayer: string;
96
+ inputMint: string;
97
+ outputMint: string;
98
+ amount: string;
99
+ requiredTokenInput: string;
100
+ destinationAddress: string;
101
+ reference: string;
102
+ recentBlockhash: string;
103
+ lastValidBlockHeight: number;
104
+ instructions: SolanaInstruction[];
105
+ addressLookupTableAccounts: SolanaAddressLookupTableAccountData[];
106
+ summary: SolanaPaymentBuildSummary;
107
+ };
59
108
  export type UserOpsSigner = {
60
109
  id: string;
61
110
  userId: string;
@@ -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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spritz-finance/service-client",
3
- "version": "0.7.2",
3
+ "version": "0.8.0",
4
4
  "gitHead": "06f8e96b7b38c34df26a38da329331940675e4f8",
5
5
  "description": "Service client",
6
6
  "license": "ISC",