@spritz-finance/api-client 0.4.5 → 0.4.6
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/README.md +30 -0
- package/dist/spritz-api-client.cjs +1 -1
- package/dist/spritz-api-client.d.ts +4 -2
- package/dist/spritz-api-client.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -105,6 +105,7 @@ const transactionData = await client.paymentRequest.getWeb3PaymentParams({
|
|
|
105
105
|
- [Payment Requests](#payment-requests)
|
|
106
106
|
- [Create a payment request](#create-a-payment-request)
|
|
107
107
|
- [Fulfil a payment request (EVM transactions)](#fulfil-a-payment-request--evm-transactions-)
|
|
108
|
+
- [Fulfil a payment request (Solana transactions)](#fulfil-a-payment-request--solana-transactions-)
|
|
108
109
|
- [Transaction fees](#transaction-fees)
|
|
109
110
|
- [Payments](#payments)
|
|
110
111
|
- [Retrieve the payment for a payment request](#retrieve-the-payment-for-a-payment-request)
|
|
@@ -708,6 +709,35 @@ const transactionData = await client.paymentRequest.getWeb3PaymentParams({
|
|
|
708
709
|
|
|
709
710
|
The contract address (to), calldata (data), and value are the primary components used to execute the blockchain transaction. You can use the `requiredTokenInput` to verify that the user's wallet has sufficient funds to complete the payment before initiating the transaction.
|
|
710
711
|
|
|
712
|
+
### Fulfil a payment request (Solana transactions)
|
|
713
|
+
|
|
714
|
+
For Solana payments, you need to obtain a versioned transaction that can be signed and submitted to the Solana network.
|
|
715
|
+
|
|
716
|
+
```typescript
|
|
717
|
+
import {PaymentNetwork} from '@spritz-finance/api-client';
|
|
718
|
+
|
|
719
|
+
const paymentRequest = await client.paymentRequest.create({
|
|
720
|
+
amount: 100,
|
|
721
|
+
accountId: account.id,
|
|
722
|
+
network: PaymentNetwork.Solana,
|
|
723
|
+
});
|
|
724
|
+
|
|
725
|
+
const transactionData = await client.paymentRequest.getSolanaPaymentParams({
|
|
726
|
+
paymentRequest,
|
|
727
|
+
paymentTokenAddress: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC on Solana
|
|
728
|
+
signer: 'YourSolanaWalletAddress...',
|
|
729
|
+
})
|
|
730
|
+
|
|
731
|
+
// Example response
|
|
732
|
+
|
|
733
|
+
{
|
|
734
|
+
versionedTransaction: VersionedTransaction, // Deserialized transaction ready to sign
|
|
735
|
+
transactionSerialized: 'base64EncodedTransaction...' // Base64 encoded transaction
|
|
736
|
+
}
|
|
737
|
+
```
|
|
738
|
+
|
|
739
|
+
The `versionedTransaction` is a deserialized Solana transaction that can be signed with your wallet and submitted to the network. The `transactionSerialized` contains the same transaction in base64 encoded format if needed for your implementation.
|
|
740
|
+
|
|
711
741
|
### Transaction fees
|
|
712
742
|
|
|
713
743
|
Transaction fees are applied once the monthly transaction volume exceeds $100. To determine the fee amount for a specific payment value, you can use the following endpoint.
|
|
@@ -505,4 +505,4 @@ By default, this is deactivated due to the potential risk of exposing your confi
|
|
|
505
505
|
If you're aware of these risks and have taken necessary security measures, you can enable the \`dangerouslyAllowBrowser\` option, e.g.,
|
|
506
506
|
|
|
507
507
|
SpritzApiClient.initialize({ apiKey, dangerouslyAllowBrowser: true });
|
|
508
|
-
`)}static initialize({environment:n=or.Sandbox,apiKey:t,integrationKey:i,dangerouslyAllowBrowser:u=!1}){const r=new Bs(n,t,i,u);return r.init(),r}init(){this.client=new Qp({environment:this.environment,apiKey:this.apiKey,integrationKey:this.integrationKey}),this.user=new vb(this.client),this.bankAccount=new W3(this.client),this.paymentRequest=new rb(this.client),this.payment=new A1(this.client),this.onrampPayment=new g1(this.client),this.virtualCard=new Db(this.client),this.bill=new r1(this.client),this.institution=new d1(this.client),this.webhook=new Bb(this.client)}setApiKey(n){return this.apiKey=n,this.init(),this}}var rv=(e=>(e.Ethereum="ethereum",e.Polygon="polygon",e.Optimism="optimism",e.Arbitrum="arbitrum",e.Binance="binance-smart-chain",e.Avalanche="avalanche",e.
|
|
508
|
+
`)}static initialize({environment:n=or.Sandbox,apiKey:t,integrationKey:i,dangerouslyAllowBrowser:u=!1}){const r=new Bs(n,t,i,u);return r.init(),r}init(){this.client=new Qp({environment:this.environment,apiKey:this.apiKey,integrationKey:this.integrationKey}),this.user=new vb(this.client),this.bankAccount=new W3(this.client),this.paymentRequest=new rb(this.client),this.payment=new A1(this.client),this.onrampPayment=new g1(this.client),this.virtualCard=new Db(this.client),this.bill=new r1(this.client),this.institution=new d1(this.client),this.webhook=new Bb(this.client)}setApiKey(n){return this.apiKey=n,this.init(),this}}var rv=(e=>(e.Ethereum="ethereum",e.Polygon="polygon",e.Optimism="optimism",e.Arbitrum="arbitrum",e.Binance="binance-smart-chain",e.Avalanche="avalanche",e.Base="base",e.Bitcoin="bitcoin",e.Dash="dash",e.Tron="tron",e.Solana="solana",e.Sui="sui",e))(rv||{});exports.BankAccountSubType=Gf,exports.BankAccountType=et,exports.BillType=Jf,exports.Environment=or,exports.PayableAccountType=Kf,exports.PaymentNetwork=rv,exports.PaymentRequestStatus=Hf,exports.PaymentStatus=Qf,exports.SpritzApiClient=Bs,exports.VirtualCardType=bo;
|
|
@@ -1440,10 +1440,12 @@ declare enum PaymentNetwork {
|
|
|
1440
1440
|
Arbitrum = "arbitrum",
|
|
1441
1441
|
Binance = "binance-smart-chain",
|
|
1442
1442
|
Avalanche = "avalanche",
|
|
1443
|
+
Base = "base",
|
|
1443
1444
|
Bitcoin = "bitcoin",
|
|
1444
|
-
BitcoinTestnet = "bitcoin-testnet",
|
|
1445
1445
|
Dash = "dash",
|
|
1446
|
-
|
|
1446
|
+
Tron = "tron",
|
|
1447
|
+
Solana = "solana",
|
|
1448
|
+
Sui = "sui"
|
|
1447
1449
|
}
|
|
1448
1450
|
interface CreatePaymentRequestInput {
|
|
1449
1451
|
accountId: string;
|
|
@@ -505,4 +505,4 @@ By default, this is deactivated due to the potential risk of exposing your confi
|
|
|
505
505
|
If you're aware of these risks and have taken necessary security measures, you can enable the \`dangerouslyAllowBrowser\` option, e.g.,
|
|
506
506
|
|
|
507
507
|
SpritzApiClient.initialize({ apiKey, dangerouslyAllowBrowser: true });
|
|
508
|
-
`)}static initialize({environment:n=or.Sandbox,apiKey:t,integrationKey:i,dangerouslyAllowBrowser:u=!1}){const r=new Bs(n,t,i,u);return r.init(),r}init(){this.client=new Wp({environment:this.environment,apiKey:this.apiKey,integrationKey:this.integrationKey}),this.user=new pb(this.client),this.bankAccount=new Y3(this.client),this.paymentRequest=new ab(this.client),this.payment=new S1(this.client),this.onrampPayment=new E1(this.client),this.virtualCard=new Bb(this.client),this.bill=new a1(this.client),this.institution=new f1(this.client),this.webhook=new _b(this.client)}setApiKey(n){return this.apiKey=n,this.init(),this}}var iv=(e=>(e.Ethereum="ethereum",e.Polygon="polygon",e.Optimism="optimism",e.Arbitrum="arbitrum",e.Binance="binance-smart-chain",e.Avalanche="avalanche",e.
|
|
508
|
+
`)}static initialize({environment:n=or.Sandbox,apiKey:t,integrationKey:i,dangerouslyAllowBrowser:u=!1}){const r=new Bs(n,t,i,u);return r.init(),r}init(){this.client=new Wp({environment:this.environment,apiKey:this.apiKey,integrationKey:this.integrationKey}),this.user=new pb(this.client),this.bankAccount=new Y3(this.client),this.paymentRequest=new ab(this.client),this.payment=new S1(this.client),this.onrampPayment=new E1(this.client),this.virtualCard=new Bb(this.client),this.bill=new a1(this.client),this.institution=new f1(this.client),this.webhook=new _b(this.client)}setApiKey(n){return this.apiKey=n,this.init(),this}}var iv=(e=>(e.Ethereum="ethereum",e.Polygon="polygon",e.Optimism="optimism",e.Arbitrum="arbitrum",e.Binance="binance-smart-chain",e.Avalanche="avalanche",e.Base="base",e.Bitcoin="bitcoin",e.Dash="dash",e.Tron="tron",e.Solana="solana",e.Sui="sui",e))(iv||{});export{Mf as BankAccountSubType,et as BankAccountType,Gf as BillType,or as Environment,Hf as PayableAccountType,iv as PaymentNetwork,Jf as PaymentRequestStatus,Kf as PaymentStatus,Bs as SpritzApiClient,bo as VirtualCardType};
|