@spritz-finance/service-client 0.7.1 → 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.
@@ -1,7 +1,7 @@
1
1
  export * as LiabilitiesClient from "./liabilitiesServiceClient";
2
2
  import { CheckbookUser } from "../lib/graphClient/generated";
3
3
  import { ExternalBillInput } from "../payableAccounts/types";
4
- import { CheckbookCardResponse, CheckbookDebitCardResponse, CheckbookDigitalAccountResponse, CheckbookUpdateCardResponse, CreateCheckbookUserParams, CreateDebitCardInput, CreateDigitalAccountInput, CreateEntityParams, DirectPaymentResponse, MethodFiEntity, RewardTransaction } from "./types";
4
+ import { CheckbookCardResponse, CheckbookDebitCardResponse, CheckbookDigitalAccountResponse, CheckbookUpdateCardResponse, CreateCheckbookUserParams, CreateDebitCardInput, CreateDigitalAccountInput, CreateEntityParams, DirectPaymentResponse, IssueRefundCreditInput, IssueRefundCreditResult, MethodFiEntity, RewardTransaction } from "./types";
5
5
  export declare function getRewardTransaction(transactionId: string): Promise<RewardTransaction>;
6
6
  export declare function createMethodFiEntity(args: CreateEntityParams): Promise<MethodFiEntity>;
7
7
  export declare function getMethodFiEntity(userId: string): Promise<MethodFiEntity | null>;
@@ -27,3 +27,4 @@ export declare function addCashbackCredit(input: {
27
27
  }): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<RewardTransaction>>;
28
28
  export declare function getRewardTransactionsFor(userId: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<RewardTransaction[]>>;
29
29
  export declare function getDirectPayment(directPaymentId: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<DirectPaymentResponse>>;
30
+ export declare function issueRefundCredit(userId: string, input: IssueRefundCreditInput): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<IssueRefundCreditResult>>;
@@ -51,6 +51,7 @@ exports.addPromotionCredit = addPromotionCredit;
51
51
  exports.addCashbackCredit = addCashbackCredit;
52
52
  exports.getRewardTransactionsFor = getRewardTransactionsFor;
53
53
  exports.getDirectPayment = getDirectPayment;
54
+ exports.issueRefundCredit = issueRefundCredit;
54
55
  exports.LiabilitiesClient = __importStar(require("./liabilitiesServiceClient"));
55
56
  const serviceClient_1 = require("../serviceClient");
56
57
  const LIABILITIES_ENDPOINT = "/liabilities";
@@ -146,3 +147,8 @@ async function getDirectPayment(directPaymentId) {
146
147
  .get(`${LIABILITIES_V2_ENDPOINT}/direct-payment/${directPaymentId}`)
147
148
  .then((res) => res.data);
148
149
  }
150
+ async function issueRefundCredit(userId, input) {
151
+ return serviceClient_1.baseClient
152
+ .post(`${LIABILITIES_V2_ENDPOINT}/rewards/users/${userId}/refund-credits`, input)
153
+ .then((res) => res.data);
154
+ }
@@ -12,9 +12,12 @@ export declare enum RewardCreditSource {
12
12
  REFERRER_REWARD = "REFERRER_REWARD",
13
13
  REFERRAL_REWARD = "REFERRAL_REWARD",
14
14
  CONTEST = "CONTEST",
15
+ CASHBACK = "CASHBACK",
16
+ COMPENSATION = "COMPENSATION",
15
17
  REFUND = "REFUND",
16
18
  OTHER = "OTHER",
17
- REVENUE_SHARE = "REVENUE_SHARE"
19
+ REVENUE_SHARE = "REVENUE_SHARE",
20
+ PROMOTION = "PROMOTION"
18
21
  }
19
22
  export type CheckbookCardResponse = {
20
23
  userId: string;
@@ -54,7 +57,16 @@ export interface RewardTransaction {
54
57
  updatedAt: string;
55
58
  userId: string;
56
59
  context?: string;
60
+ reference?: string;
57
61
  }
62
+ export type IssueRefundCreditInput = {
63
+ amount: number;
64
+ reference: string;
65
+ };
66
+ export type IssueRefundCreditResult = {
67
+ credit: RewardTransaction;
68
+ created: boolean;
69
+ };
58
70
  type TEntityTypes = "individual" | "c_corporation" | "s_corporation" | "llc" | "partnership" | "sole_proprietorship" | "receive_only";
59
71
  interface IEntityIndividual {
60
72
  first_name: string | null;
@@ -17,7 +17,10 @@ var RewardCreditSource;
17
17
  RewardCreditSource["REFERRER_REWARD"] = "REFERRER_REWARD";
18
18
  RewardCreditSource["REFERRAL_REWARD"] = "REFERRAL_REWARD";
19
19
  RewardCreditSource["CONTEST"] = "CONTEST";
20
+ RewardCreditSource["CASHBACK"] = "CASHBACK";
21
+ RewardCreditSource["COMPENSATION"] = "COMPENSATION";
20
22
  RewardCreditSource["REFUND"] = "REFUND";
21
23
  RewardCreditSource["OTHER"] = "OTHER";
22
24
  RewardCreditSource["REVENUE_SHARE"] = "REVENUE_SHARE";
25
+ RewardCreditSource["PROMOTION"] = "PROMOTION";
23
26
  })(RewardCreditSource || (exports.RewardCreditSource = RewardCreditSource = {}));
@@ -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.1",
3
+ "version": "0.8.0",
4
4
  "gitHead": "06f8e96b7b38c34df26a38da329331940675e4f8",
5
5
  "description": "Service client",
6
6
  "license": "ISC",