@spritz-finance/api-client 0.0.3 → 0.0.4
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.
|
@@ -6,21 +6,10 @@ declare enum Environment {
|
|
|
6
6
|
Production = "production"
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
declare enum AccountProvider {
|
|
10
|
+
CHECKBOOK = "CHECKBOOK",
|
|
11
|
+
METHOD_FI = "METHOD_FI"
|
|
12
12
|
}
|
|
13
|
-
declare class GraphClient {
|
|
14
|
-
client: AxiosInstance;
|
|
15
|
-
constructor(environment: Environment, apiKey: string);
|
|
16
|
-
query<Q = any, V = any>({ query, variables }: QueryParams<V>): Promise<Q>;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
declare class AccountsService {
|
|
20
|
-
private client;
|
|
21
|
-
constructor(client: GraphClient);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
13
|
declare enum BankAccountSubType {
|
|
25
14
|
Business = "Business",
|
|
26
15
|
Checking = "Checking",
|
|
@@ -29,6 +18,16 @@ declare enum BankAccountSubType {
|
|
|
29
18
|
declare enum BankAccountType {
|
|
30
19
|
USBankAccount = "USBankAccount"
|
|
31
20
|
}
|
|
21
|
+
declare enum DirectPaymentStatus {
|
|
22
|
+
COMPLETED = "COMPLETED",
|
|
23
|
+
CONFIRMED = "CONFIRMED",
|
|
24
|
+
CREATED = "CREATED",
|
|
25
|
+
FAILED = "FAILED",
|
|
26
|
+
PENDING = "PENDING",
|
|
27
|
+
REFUNDED = "REFUNDED",
|
|
28
|
+
TRANSACTION_FAILED = "TRANSACTION_FAILED",
|
|
29
|
+
TRANSACTION_PENDING = "TRANSACTION_PENDING"
|
|
30
|
+
}
|
|
32
31
|
declare enum ModuleStatus {
|
|
33
32
|
ACTIVE = "ACTIVE",
|
|
34
33
|
FAILED = "FAILED",
|
|
@@ -42,6 +41,16 @@ declare enum PayableAccountType {
|
|
|
42
41
|
Bill = "Bill",
|
|
43
42
|
DebitCard = "DebitCard"
|
|
44
43
|
}
|
|
44
|
+
interface CreateDirectPaymentInput {
|
|
45
|
+
accountId: string;
|
|
46
|
+
amount: number;
|
|
47
|
+
network?: string | null;
|
|
48
|
+
provider?: AccountProvider | null;
|
|
49
|
+
rewardsAmount?: number | null;
|
|
50
|
+
subscriptionId?: string | null;
|
|
51
|
+
testPayment?: boolean | null;
|
|
52
|
+
tokenAddress?: string | null;
|
|
53
|
+
}
|
|
45
54
|
interface USBankAccountInput {
|
|
46
55
|
accountNumber: string;
|
|
47
56
|
email: string;
|
|
@@ -181,6 +190,25 @@ interface CurrentUser {
|
|
|
181
190
|
me: CurrentUser_me;
|
|
182
191
|
}
|
|
183
192
|
|
|
193
|
+
interface GetSpritzPayParams_spritzPayParams {
|
|
194
|
+
__typename: 'PaymentParams';
|
|
195
|
+
contractAddress: string;
|
|
196
|
+
method: string;
|
|
197
|
+
calldata: string;
|
|
198
|
+
value: string | null;
|
|
199
|
+
requiredTokenInput: string;
|
|
200
|
+
suggestedGasLimit: string | null;
|
|
201
|
+
}
|
|
202
|
+
interface GetSpritzPayParams {
|
|
203
|
+
spritzPayParams: GetSpritzPayParams_spritzPayParams;
|
|
204
|
+
}
|
|
205
|
+
interface GetSpritzPayParamsVariables {
|
|
206
|
+
tokenAddress: string;
|
|
207
|
+
amount: number;
|
|
208
|
+
reference: string;
|
|
209
|
+
network: string;
|
|
210
|
+
}
|
|
211
|
+
|
|
184
212
|
interface PayableAccountFragment_Bill_institution {
|
|
185
213
|
__typename: 'BankAccountInstitution' | 'BillInstitution';
|
|
186
214
|
id: string;
|
|
@@ -236,6 +264,17 @@ interface PayableAccountFragment_BankAccount {
|
|
|
236
264
|
}
|
|
237
265
|
type PayableAccountFragment = PayableAccountFragment_Bill | PayableAccountFragment_BankAccount;
|
|
238
266
|
|
|
267
|
+
interface PaymentRequestFragment {
|
|
268
|
+
__typename: 'DirectPayment';
|
|
269
|
+
id: string;
|
|
270
|
+
userId: any;
|
|
271
|
+
accountId: any;
|
|
272
|
+
status: DirectPaymentStatus;
|
|
273
|
+
amount: number;
|
|
274
|
+
network: string;
|
|
275
|
+
createdAt: any;
|
|
276
|
+
}
|
|
277
|
+
|
|
239
278
|
interface TokenBalanceFragment {
|
|
240
279
|
__typename: 'TokenBalance';
|
|
241
280
|
/**
|
|
@@ -462,6 +501,16 @@ interface CreateUSBankAccountVariables {
|
|
|
462
501
|
createUSAccountInput: USBankAccountInput;
|
|
463
502
|
}
|
|
464
503
|
|
|
504
|
+
interface QueryParams<V = any> {
|
|
505
|
+
query: DocumentNode;
|
|
506
|
+
variables?: V;
|
|
507
|
+
}
|
|
508
|
+
declare class GraphClient {
|
|
509
|
+
client: AxiosInstance;
|
|
510
|
+
constructor(environment: Environment, apiKey: string);
|
|
511
|
+
query<Q = any, V = any>({ query, variables }: QueryParams<V>): Promise<Q>;
|
|
512
|
+
}
|
|
513
|
+
|
|
465
514
|
type CreateInputMapping = {
|
|
466
515
|
[BankAccountType.USBankAccount]: USBankAccountInput;
|
|
467
516
|
};
|
|
@@ -472,7 +521,7 @@ type CreateMutationMapping = {
|
|
|
472
521
|
response: keyof CreateUSBankAccount;
|
|
473
522
|
};
|
|
474
523
|
};
|
|
475
|
-
declare class
|
|
524
|
+
declare class BankAccountService {
|
|
476
525
|
private client;
|
|
477
526
|
constructor(client: GraphClient);
|
|
478
527
|
list(): Promise<UserBankAccounts_userBankAccounts[]>;
|
|
@@ -481,6 +530,61 @@ declare class BankAccountsService {
|
|
|
481
530
|
create<T extends BankAccountType>(type: T, input: CreateInputMapping[T]): Promise<NonNullable<CreateMutationMapping[T]["query"][keyof CreateMutationMapping[T]["query"]]> | null>;
|
|
482
531
|
}
|
|
483
532
|
|
|
533
|
+
interface CreatePaymentRequest_createDirectPayment {
|
|
534
|
+
__typename: 'DirectPayment';
|
|
535
|
+
id: string;
|
|
536
|
+
userId: any;
|
|
537
|
+
accountId: any;
|
|
538
|
+
status: DirectPaymentStatus;
|
|
539
|
+
amount: number;
|
|
540
|
+
network: string;
|
|
541
|
+
createdAt: any;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
declare enum PaymentNetwork {
|
|
545
|
+
Ethereum = "ethereum",
|
|
546
|
+
Polygon = "polygon",
|
|
547
|
+
Optimism = "optimism",
|
|
548
|
+
Arbitrum = "arbitrum",
|
|
549
|
+
Binance = "binance-smart-chain",
|
|
550
|
+
Avalanche = "avalanche",
|
|
551
|
+
Bitcoin = "bitcoin",
|
|
552
|
+
BitcoinTestnet = "bitcoin-testnet",
|
|
553
|
+
Dash = "dash",
|
|
554
|
+
DashTestnet = "dash-testnet"
|
|
555
|
+
}
|
|
556
|
+
interface CreatePaymentRequestInput {
|
|
557
|
+
accountId: string;
|
|
558
|
+
amount: number;
|
|
559
|
+
network: PaymentNetwork;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
declare class PaymentRequestService {
|
|
563
|
+
private client;
|
|
564
|
+
constructor(client: GraphClient);
|
|
565
|
+
create(input: CreatePaymentRequestInput): Promise<CreatePaymentRequest_createDirectPayment>;
|
|
566
|
+
/**
|
|
567
|
+
* Retrieves the Web3 payment parameters for a specified payment request.
|
|
568
|
+
*
|
|
569
|
+
* @async
|
|
570
|
+
* @param {Object} input - The input object containing payment request details.
|
|
571
|
+
* @param {string} input.paymentRequestId - The unique identifier for the payment request.
|
|
572
|
+
* @param {number} input.amount - The amount to be paid in the transaction, decimals in USD (eg. 12.45)
|
|
573
|
+
* @param {PaymentNetwork} input.network - The Ethereum network to be used for the transaction
|
|
574
|
+
* @param {string} input.paymentTokenAddress - The Ethereum address of the ERC20 token used for payment.
|
|
575
|
+
* @param {boolean} [validateChecksum=false] - Optional flag to validate the EIP-55 checksum of the paymentTokenAddress.
|
|
576
|
+
* If set to true, the function will throw an error if the checksum is invalid. Default is false.
|
|
577
|
+
* @returns {Promise<Object>} A Promise that resolves to an object containing the Web3 payment parameters.
|
|
578
|
+
* @throws {Error} If the validateChecksum flag is true and the paymentTokenAddress has an invalid EIP-55 checksum.
|
|
579
|
+
*/
|
|
580
|
+
getWeb3PaymentParams(input: {
|
|
581
|
+
paymentRequestId: string;
|
|
582
|
+
amount: number;
|
|
583
|
+
network: PaymentNetwork;
|
|
584
|
+
paymentTokenAddress: string;
|
|
585
|
+
}, validateChecksum?: boolean): Promise<GetSpritzPayParams_spritzPayParams>;
|
|
586
|
+
}
|
|
587
|
+
|
|
484
588
|
declare class UserService {
|
|
485
589
|
private client;
|
|
486
590
|
constructor(client: GraphClient);
|
|
@@ -490,11 +594,11 @@ declare class UserService {
|
|
|
490
594
|
|
|
491
595
|
declare class SpritzApiClient {
|
|
492
596
|
private client;
|
|
493
|
-
accounts: AccountsService;
|
|
494
597
|
user: UserService;
|
|
495
|
-
|
|
598
|
+
bankAccount: BankAccountService;
|
|
599
|
+
paymentRequest: PaymentRequestService;
|
|
496
600
|
static initialize(environment: Environment, apiKey: string): SpritzApiClient;
|
|
497
601
|
private init;
|
|
498
602
|
}
|
|
499
603
|
|
|
500
|
-
export { BankAccountFragment, BankAccountFragment_bankAccountDetails, BankAccountFragment_bankAccountDetails_CanadianBankAccountDetails, BankAccountFragment_bankAccountDetails_USBankAccountDetails, BankAccountFragment_institution, BankAccountSubType, BankAccountType, CurrentUser, CurrentUser_me, Environment, ModuleStatus, PayableAccountFragment, PayableAccountFragment_BankAccount, PayableAccountFragment_BankAccount_bankAccountDetails, PayableAccountFragment_BankAccount_bankAccountDetails_CanadianBankAccountDetails, PayableAccountFragment_BankAccount_bankAccountDetails_USBankAccountDetails, PayableAccountFragment_BankAccount_institution, PayableAccountFragment_Bill, PayableAccountFragment_Bill_institution, PayableAccountType, SpritzApiClient, TokenBalanceFragment, USBankAccountInput, UserBankAccounts, UserBankAccounts_userBankAccounts, UserBankAccounts_userBankAccounts_bankAccountDetails, UserBankAccounts_userBankAccounts_bankAccountDetails_CanadianBankAccountDetails, UserBankAccounts_userBankAccounts_bankAccountDetails_USBankAccountDetails, UserBankAccounts_userBankAccounts_institution, UserFragment, UserPayableAccounts, UserPayableAccounts_payableAccounts, UserPayableAccounts_payableAccounts_BankAccount, UserPayableAccounts_payableAccounts_BankAccount_bankAccountDetails, UserPayableAccounts_payableAccounts_BankAccount_bankAccountDetails_CanadianBankAccountDetails, UserPayableAccounts_payableAccounts_BankAccount_bankAccountDetails_USBankAccountDetails, UserPayableAccounts_payableAccounts_BankAccount_institution, UserPayableAccounts_payableAccounts_Bill, UserPayableAccounts_payableAccounts_Bill_institution, UserVerification, UserVerification_verification, UserVerification_verification_identity, UserVerification_verification_identity_user, WalletTokenBalances, WalletTokenBalancesVariables, WalletTokenBalances_tokenBalances };
|
|
604
|
+
export { AccountProvider, BankAccountFragment, BankAccountFragment_bankAccountDetails, BankAccountFragment_bankAccountDetails_CanadianBankAccountDetails, BankAccountFragment_bankAccountDetails_USBankAccountDetails, BankAccountFragment_institution, BankAccountSubType, BankAccountType, CreateDirectPaymentInput, CreatePaymentRequestInput, CurrentUser, CurrentUser_me, DirectPaymentStatus, Environment, GetSpritzPayParams, GetSpritzPayParamsVariables, GetSpritzPayParams_spritzPayParams, ModuleStatus, PayableAccountFragment, PayableAccountFragment_BankAccount, PayableAccountFragment_BankAccount_bankAccountDetails, PayableAccountFragment_BankAccount_bankAccountDetails_CanadianBankAccountDetails, PayableAccountFragment_BankAccount_bankAccountDetails_USBankAccountDetails, PayableAccountFragment_BankAccount_institution, PayableAccountFragment_Bill, PayableAccountFragment_Bill_institution, PayableAccountType, PaymentNetwork, PaymentRequestFragment, SpritzApiClient, TokenBalanceFragment, USBankAccountInput, UserBankAccounts, UserBankAccounts_userBankAccounts, UserBankAccounts_userBankAccounts_bankAccountDetails, UserBankAccounts_userBankAccounts_bankAccountDetails_CanadianBankAccountDetails, UserBankAccounts_userBankAccounts_bankAccountDetails_USBankAccountDetails, UserBankAccounts_userBankAccounts_institution, UserFragment, UserPayableAccounts, UserPayableAccounts_payableAccounts, UserPayableAccounts_payableAccounts_BankAccount, UserPayableAccounts_payableAccounts_BankAccount_bankAccountDetails, UserPayableAccounts_payableAccounts_BankAccount_bankAccountDetails_CanadianBankAccountDetails, UserPayableAccounts_payableAccounts_BankAccount_bankAccountDetails_USBankAccountDetails, UserPayableAccounts_payableAccounts_BankAccount_institution, UserPayableAccounts_payableAccounts_Bill, UserPayableAccounts_payableAccounts_Bill_institution, UserVerification, UserVerification_verification, UserVerification_verification_identity, UserVerification_verification_identity_user, WalletTokenBalances, WalletTokenBalancesVariables, WalletTokenBalances_tokenBalances };
|