@spritz-finance/api-client 0.2.8 → 0.3.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/README.md CHANGED
@@ -65,6 +65,9 @@ A Typescript library for interacting with the Spritz Finance API
65
65
  - [Payments](#payments)
66
66
  - [Retrieve the payment for a payment request](#retrieve-the-payment-for-a-payment-request)
67
67
  - [Retrieve all payments for an account](#retrieve-all-payments-for-an-account)
68
+ - [Onramp Payments](#onramp-payments)
69
+ - [Create an onramp payment](#create-onramp-payment)
70
+ - [Retrieve all onramp payments for an account](#retrieve-all-onramp-payments-for-an-account)
68
71
  - [Webhooks](#webhooks)
69
72
  - [Supported webhook events](#supported-webhook-events)
70
73
  - [Account Events](#account-events)
@@ -420,7 +423,7 @@ const bills = [
420
423
  logo: 'https://tinyurl.com/shire-bank-logo',
421
424
  },
422
425
  createdAt: '2023-05-03T11:25:02.401Z',
423
- deliveryMethods: ['STANDARD']
426
+ deliveryMethods: ['STANDARD'],
424
427
  },
425
428
  ]
426
429
  ```
@@ -687,6 +690,78 @@ const payments = await client.payment.listForAccount(account.id)
687
690
  ]
688
691
  ```
689
692
 
693
+ ## Onramp Payments
694
+
695
+ Onramp Payments are orders to buy crypto stablecoins with a bank transfer. Upon creating an onramp payment, you will receive deposit instructions to fulfill that order. When the bank transfer has been received and disbursed, the status of that onramp payment will change.
696
+
697
+ ### Create onramp payment
698
+
699
+ ```typescript
700
+ const onrampPayment = await client.onrampPayment.create({
701
+ token: 'USDC' // Supported: currently only 'USDC'
702
+ network: 'ethereum' // supported: 'ethereum', 'polygon', 'avalanche'
703
+ amount: 100, // How much token to purchase (100 USDC)
704
+ address: '0xbB76483e33e01315438D8F6CF1Aee9C9b85f433b', // Wallet address to disburse tokens to
705
+ paymentMethod: 'ACH' // 'WIRE' or 'ACH'
706
+ });
707
+
708
+ // Example response
709
+
710
+ {
711
+ "id": "653fab35ad263e5ae8b0e605",
712
+ "amount": 100,
713
+ "feeAmount": 1.5,
714
+ "depositInstructions": {
715
+ "amount": 101.5,
716
+ "currency": "USD",
717
+ "bankName": "Bank of Nowhere",
718
+ "bankAddress": "1800 North Pole St., Orlando, FL 32801",
719
+ "bankBeneficiaryName": "Bridge Ventures Inc",
720
+ "bankRoutingNumber": "123456789",
721
+ "bankAccountNumber": "11223344556677",
722
+ "paymentMethod": "WIRE",
723
+ "depositMessage": "BVI72D90851F051F4189",
724
+ },
725
+ "network": "ethereum",
726
+ "token": "USDC",
727
+ "address": "0xbb76483e33e01315438d8f6cf1aee9c9b85f433b",
728
+ "status": "AWAITING_FUNDS",
729
+ "createdAt": "2023-10-30T13:10:13.521Z",
730
+ }
731
+
732
+
733
+ ```
734
+
735
+ ### Retrieve all onramp payments for an account
736
+
737
+ ```typescript
738
+ const payments = await client.onrampPayment.list()[
739
+ // Example response
740
+
741
+ {
742
+ id: '653fab35ad263e5ae8b0e605',
743
+ amount: 100,
744
+ feeAmount: 1.5,
745
+ depositInstructions: {
746
+ amount: 101.5,
747
+ currency: 'USD',
748
+ bankName: 'Bank of Nowhere',
749
+ bankAddress: '1800 North Pole St., Orlando, FL 32801',
750
+ bankBeneficiaryName: 'Bridge Ventures Inc',
751
+ bankRoutingNumber: '123456789',
752
+ bankAccountNumber: '11223344556677',
753
+ paymentMethod: 'WIRE',
754
+ depositMessage: 'BVI72D90851F051F4189',
755
+ },
756
+ network: 'ethereum',
757
+ token: 'USDC',
758
+ address: '0xbb76483e33e01315438d8f6cf1aee9c9b85f433b',
759
+ status: 'AWAITING_FUNDS',
760
+ createdAt: '2023-10-30T13:10:13.521Z',
761
+ }
762
+ ]
763
+ ```
764
+
690
765
  ## Webhooks
691
766
 
692
767
  Instead of making a request to get information, webhooks send information to your specified endpoint as soon as an event occurs. Spritz's integration offers a variety of webhook events that can be crucial for maintaining data integrity and responsiveness in applications. Let's dive into how you can best utilize these.