@huma-finance/sdk 0.0.29 → 0.0.31
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/API.md +977 -482
- package/LICENSE +660 -660
- package/README.md +34 -34
- package/dist/cjs/graphql/generatedTypes.d.ts +40 -40
- package/dist/cjs/graphql/generatedTypes.js +8 -8
- package/dist/cjs/graphql/index.d.ts +1 -1
- package/dist/cjs/graphql/index.js +4 -4
- package/dist/cjs/helpers/ERC20TransferableReceivableContractHelper.d.ts +10 -10
- package/dist/cjs/helpers/ERC20TransferableReceivableContractHelper.js +21 -21
- package/dist/cjs/helpers/PoolContractHelper.d.ts +119 -119
- package/dist/cjs/helpers/PoolContractHelper.js +142 -142
- package/dist/cjs/helpers/RealWorldReceivableContractHelper.d.ts +10 -10
- package/dist/cjs/helpers/RealWorldReceivableContractHelper.js +21 -21
- package/dist/cjs/helpers/index.d.ts +3 -3
- package/dist/cjs/helpers/index.js +6 -6
- package/dist/cjs/hooks/index.d.ts +4 -4
- package/dist/cjs/hooks/index.js +7 -7
- package/dist/cjs/hooks/useContract.d.ts +13 -13
- package/dist/cjs/hooks/useContract.js +30 -30
- package/dist/cjs/hooks/useERC20TransferableReceivableContract.d.ts +12 -12
- package/dist/cjs/hooks/useERC20TransferableReceivableContract.js +20 -20
- package/dist/cjs/hooks/usePoolContract.d.ts +60 -60
- package/dist/cjs/hooks/usePoolContract.js +53 -53
- package/dist/cjs/hooks/useRealWorldReceivableContract.d.ts +10 -10
- package/dist/cjs/hooks/useRealWorldReceivableContract.js +19 -19
- package/dist/cjs/index.d.ts +4 -4
- package/dist/cjs/index.js +7 -7
- package/dist/cjs/services/ARWeaveService.d.ts +106 -81
- package/dist/cjs/services/ARWeaveService.js +190 -145
- package/dist/cjs/services/ARWeaveService.js.map +1 -1
- package/dist/cjs/services/EAService.d.ts +20 -20
- package/dist/cjs/services/EAService.js +33 -33
- package/dist/cjs/services/ReceivableService.d.ts +105 -89
- package/dist/cjs/services/ReceivableService.js +253 -193
- package/dist/cjs/services/ReceivableService.js.map +1 -1
- package/dist/cjs/services/SubgraphService.d.ts +53 -53
- package/dist/cjs/services/SubgraphService.js +93 -93
- package/dist/cjs/services/index.d.ts +4 -4
- package/dist/cjs/services/index.js +7 -7
- package/dist/cjs/utils/chain.d.ts +15 -15
- package/dist/cjs/utils/chain.js +37 -37
- package/dist/cjs/utils/index.d.ts +4 -4
- package/dist/cjs/utils/index.js +7 -7
- package/dist/cjs/utils/maticGasStation.d.ts +3 -3
- package/dist/cjs/utils/maticGasStation.js +38 -38
- package/dist/cjs/utils/poolInfo.d.ts +8 -8
- package/dist/cjs/utils/poolInfo.js +12 -12
- package/dist/cjs/utils/web3.d.ts +5 -5
- package/dist/cjs/utils/web3.js +33 -33
- package/dist/graphql/generatedTypes.d.ts +40 -40
- package/dist/graphql/generatedTypes.js +4 -4
- package/dist/graphql/index.d.ts +1 -1
- package/dist/graphql/index.js +1 -1
- package/dist/helpers/ERC20TransferableReceivableContractHelper.d.ts +10 -10
- package/dist/helpers/ERC20TransferableReceivableContractHelper.js +17 -17
- package/dist/helpers/PoolContractHelper.d.ts +119 -119
- package/dist/helpers/PoolContractHelper.js +133 -133
- package/dist/helpers/RealWorldReceivableContractHelper.d.ts +10 -10
- package/dist/helpers/RealWorldReceivableContractHelper.js +17 -17
- package/dist/helpers/index.d.ts +3 -3
- package/dist/helpers/index.js +3 -3
- package/dist/hooks/index.d.ts +4 -4
- package/dist/hooks/index.js +4 -4
- package/dist/hooks/useContract.d.ts +13 -13
- package/dist/hooks/useContract.js +26 -26
- package/dist/hooks/useERC20TransferableReceivableContract.d.ts +12 -12
- package/dist/hooks/useERC20TransferableReceivableContract.js +16 -16
- package/dist/hooks/usePoolContract.d.ts +60 -60
- package/dist/hooks/usePoolContract.js +48 -48
- package/dist/hooks/useRealWorldReceivableContract.d.ts +10 -10
- package/dist/hooks/useRealWorldReceivableContract.js +15 -15
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/services/ARWeaveService.d.ts +106 -81
- package/dist/services/ARWeaveService.js +185 -140
- package/dist/services/ARWeaveService.js.map +1 -1
- package/dist/services/EAService.d.ts +20 -20
- package/dist/services/EAService.js +30 -30
- package/dist/services/ReceivableService.d.ts +105 -89
- package/dist/services/ReceivableService.js +249 -189
- package/dist/services/ReceivableService.js.map +1 -1
- package/dist/services/SubgraphService.d.ts +53 -53
- package/dist/services/SubgraphService.js +90 -90
- package/dist/services/index.d.ts +4 -4
- package/dist/services/index.js +4 -4
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/utils/chain.d.ts +15 -15
- package/dist/utils/chain.js +31 -31
- package/dist/utils/index.d.ts +4 -4
- package/dist/utils/index.js +4 -4
- package/dist/utils/maticGasStation.d.ts +3 -3
- package/dist/utils/maticGasStation.js +33 -33
- package/dist/utils/poolInfo.d.ts +8 -8
- package/dist/utils/poolInfo.js +8 -8
- package/dist/utils/web3.d.ts +5 -5
- package/dist/utils/web3.js +27 -27
- package/getting-started.md +190 -190
- package/package.json +6 -4
- package/dist/cjs/helpers/BaseCreditPoolReceivableContractHelper.d.ts +0 -10
- package/dist/cjs/helpers/BaseCreditPoolReceivableContractHelper.js +0 -22
- package/dist/cjs/helpers/BaseCreditPoolReceivableContractHelper.js.map +0 -1
- package/dist/cjs/hooks/useBaseCreditPoolReceivableContract.d.ts +0 -10
- package/dist/cjs/hooks/useBaseCreditPoolReceivableContract.js +0 -20
- package/dist/cjs/hooks/useBaseCreditPoolReceivableContract.js.map +0 -1
- package/dist/cjs/hooks/useReceivableFactoringPoolContract.d.ts +0 -10
- package/dist/cjs/hooks/useReceivableFactoringPoolContract.js +0 -17
- package/dist/cjs/hooks/useReceivableFactoringPoolContract.js.map +0 -1
- package/dist/helpers/BaseCreditPoolReceivableContractHelper.d.ts +0 -10
- package/dist/helpers/BaseCreditPoolReceivableContractHelper.js +0 -18
- package/dist/helpers/BaseCreditPoolReceivableContractHelper.js.map +0 -1
- package/dist/hooks/useBaseCreditPoolReceivableContract.d.ts +0 -10
- package/dist/hooks/useBaseCreditPoolReceivableContract.js +0 -16
- package/dist/hooks/useBaseCreditPoolReceivableContract.js.map +0 -1
- package/dist/hooks/usePool.d.ts +0 -0
- package/dist/hooks/usePool.js +0 -2
- package/dist/hooks/usePool.js.map +0 -1
- package/dist/hooks/useReceivableFactoringPoolContract.d.ts +0 -10
- package/dist/hooks/useReceivableFactoringPoolContract.js +0 -13
- package/dist/hooks/useReceivableFactoringPoolContract.js.map +0 -1
package/getting-started.md
CHANGED
|
@@ -1,191 +1,191 @@
|
|
|
1
|
-
# Getting Started
|
|
2
|
-
|
|
3
|
-
In this guide we'll take a look at using Huma's SDK to mint and pay a receivable, call functions on our pool, and more.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
Huma's SDK can be installed using npm or yarn.
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
npm install @huma-finance/sdk
|
|
11
|
-
yarn add @huma-finance/sdk
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
You'll also want to install Huma's shared utilities
|
|
15
|
-
|
|
16
|
-
```
|
|
17
|
-
npm install @huma-finance/shared
|
|
18
|
-
yarn add @huma-finance/shared
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Mint a Pool Receivable
|
|
22
|
-
|
|
23
|
-
Create a new file `index.js` and import services from `@huma-finance/sdk` and `@huma-finance/shared`
|
|
24
|
-
|
|
25
|
-
```
|
|
26
|
-
import { ReceivableService, PaymentMethod } from '@huma-finance/sdk'
|
|
27
|
-
import { POOL_NAME, POOL_TYPE } from "@huma-finance/shared";
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
Set up your ethers Provider and import your private key
|
|
31
|
-
|
|
32
|
-
```
|
|
33
|
-
const TEST_PRIVATE_KEY = "YOUR_PRIVATE_KEY";
|
|
34
|
-
const provider = new ethers.providers.JsonRpcProvider(
|
|
35
|
-
`https://goerli.infura.io/v3/${INFURA_API_KEY}`,
|
|
36
|
-
{
|
|
37
|
-
name: "Goerli",
|
|
38
|
-
chainId: 5,
|
|
39
|
-
}
|
|
40
|
-
);
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
Call on the `mintReceivable` method with an ethers Wallet instance
|
|
44
|
-
|
|
45
|
-
> Note: Receivables support multiple payment methods. Declarative receivables
|
|
46
|
-
> don't actually transfer ERC20 tokens, they just update their balance on-chain.
|
|
47
|
-
> Payable receivables will actually call pool methods to transfer ERC20 tokens.
|
|
48
|
-
|
|
49
|
-
```
|
|
50
|
-
const wallet = new Wallet(TEST_PRIVATE_KEY, provider);
|
|
51
|
-
const tx = await ReceivableService.mintReceivable(
|
|
52
|
-
wallet,
|
|
53
|
-
POOL_NAME.HumaCreditLine,
|
|
54
|
-
POOL_TYPE.CreditLine,
|
|
55
|
-
1000, // receivableAmount
|
|
56
|
-
1684517656, // maturityDate
|
|
57
|
-
PaymentMethod.Declarative, // paymentMethod
|
|
58
|
-
""
|
|
59
|
-
);
|
|
60
|
-
const data = await tx.wait();
|
|
61
|
-
console.log(`Success. Tx hash: ${data.transactionHash}`);
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
Running this in the console, we should see the following result
|
|
65
|
-
|
|
66
|
-
```
|
|
67
|
-
$ node index.js
|
|
68
|
-
{}
|
|
69
|
-
Success. Tx hash: 0xb789af3611bc01b6a90f002327500421abf575660be1bbb30013d52518260e41
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
Congrats! You've successfully minted your own receivable token, which are used to borrow from Huma's pools.
|
|
73
|
-
|
|
74
|
-
If you're stuck or want to view a complete solution, check out our `examples` directory (here)[https://github.com/00labs/huma-dapp/blob/develop/packages/examples/src/]
|
|
75
|
-
|
|
76
|
-
## Call functions from Huma's pool
|
|
77
|
-
|
|
78
|
-
We can use the Huma SDK to easily obtain ethers Contract instances of any Huma pool.
|
|
79
|
-
|
|
80
|
-
```
|
|
81
|
-
import { getPoolContract } from "@huma-finance/sdk";
|
|
82
|
-
import { POOL_NAME, POOL_TYPE } from "@huma-finance/shared";
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
With a ethers provider, pass in some config options for which pool contract you'd like to fetch.
|
|
86
|
-
|
|
87
|
-
```
|
|
88
|
-
const poolContract = getPoolContract(
|
|
89
|
-
wallet,
|
|
90
|
-
5, // Goerli chain ID
|
|
91
|
-
POOL_NAME.HumaCreditLine,
|
|
92
|
-
POOL_TYPE.CreditLine
|
|
93
|
-
);
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
Now you can call any functions you want on the pool as if it were any other ethers Contract. Let's try fetching credit record details of our current account:
|
|
97
|
-
|
|
98
|
-
```
|
|
99
|
-
const data = await poolContract.creditRecordMapping(wallet.address);
|
|
100
|
-
console.log(data);
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
Running this in the console, you should see something like this
|
|
104
|
-
|
|
105
|
-
```
|
|
106
|
-
$ node index.js
|
|
107
|
-
[
|
|
108
|
-
BigNumber { _hex: '0x00', _isBigNumber: true },
|
|
109
|
-
BigNumber { _hex: '0x00', _isBigNumber: true },
|
|
110
|
-
BigNumber { _hex: '0x00', _isBigNumber: true },
|
|
111
|
-
BigNumber { _hex: '0x00', _isBigNumber: true },
|
|
112
|
-
BigNumber { _hex: '0x00', _isBigNumber: true },
|
|
113
|
-
0,
|
|
114
|
-
0,
|
|
115
|
-
0,
|
|
116
|
-
unbilledPrincipal: BigNumber { _hex: '0x00', _isBigNumber: true },
|
|
117
|
-
dueDate: BigNumber { _hex: '0x00', _isBigNumber: true },
|
|
118
|
-
correction: BigNumber { _hex: '0x00', _isBigNumber: true },
|
|
119
|
-
totalDue: BigNumber { _hex: '0x00', _isBigNumber: true },
|
|
120
|
-
feesAndInterestDue: BigNumber { _hex: '0x00', _isBigNumber: true },
|
|
121
|
-
missedPeriods: 0,
|
|
122
|
-
remainingPeriods: 0,
|
|
123
|
-
state: 0
|
|
124
|
-
]
|
|
125
|
-
Done in 4.90s.
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
# Other SDK examples
|
|
129
|
-
|
|
130
|
-
## Declare a receivable as paid
|
|
131
|
-
|
|
132
|
-
Once we've minted a receivable, we can use the `ReceivableService` to pay it off using multiple types of payment methods.
|
|
133
|
-
|
|
134
|
-
```
|
|
135
|
-
const wallet = new Wallet(TEST_PRIVATE_KEY, provider);
|
|
136
|
-
|
|
137
|
-
const data = await ReceivableService.payReceivableByTokenId(
|
|
138
|
-
wallet,
|
|
139
|
-
8, // receivableTokenId
|
|
140
|
-
10, // paymentAmount
|
|
141
|
-
PaymentMethod.Declarative // paymentMethod
|
|
142
|
-
);
|
|
143
|
-
console.log(`Success. Tx hash: ${data.transactionHash}`);
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
## Mint a receivable with metadata automatically uploaded to ARWeave
|
|
147
|
-
|
|
148
|
-
Huma supports both lazy funding and pre-funding the ARWeave network to pay for metadata uploads.
|
|
149
|
-
|
|
150
|
-
```
|
|
151
|
-
// Prefund...
|
|
152
|
-
await prefundBundlr(getBundlrNetworkConfig(5), signer, 1_000_000)
|
|
153
|
-
|
|
154
|
-
// Or pay as you go! (Note: it's recommended you still prefund with a small
|
|
155
|
-
// amount of currency to avoid slippage)
|
|
156
|
-
const data = await ReceivableService.mintReceivableWithMetadata(
|
|
157
|
-
signer,
|
|
158
|
-
TEST_PRIVATE_KEY,
|
|
159
|
-
chainId,
|
|
160
|
-
poolName,
|
|
161
|
-
poolType,
|
|
162
|
-
receivableAmount,
|
|
163
|
-
maturityDate,
|
|
164
|
-
paymentMethod,
|
|
165
|
-
JSON.parse(metadata),
|
|
166
|
-
internalID,
|
|
167
|
-
[],
|
|
168
|
-
)
|
|
169
|
-
setMintResult(`Success, Tx Hash: ${data.transactionHash}`)
|
|
170
|
-
console.log(data)
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
## Query for receivables uploaded to ARWeave
|
|
174
|
-
|
|
175
|
-
Once metadata is uploaded to ARWeave, you can query them by referenceId tags, which you can specify during upload.
|
|
176
|
-
|
|
177
|
-
```
|
|
178
|
-
const data = await ARWeaveService.queryForMetadata(
|
|
179
|
-
chainId,
|
|
180
|
-
poolName,
|
|
181
|
-
poolType,
|
|
182
|
-
address,
|
|
183
|
-
'12', // referenceId
|
|
184
|
-
)
|
|
185
|
-
setQueryResult(data)
|
|
186
|
-
console.log(data)
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
## Next steps
|
|
190
|
-
|
|
1
|
+
# Getting Started
|
|
2
|
+
|
|
3
|
+
In this guide we'll take a look at using Huma's SDK to mint and pay a receivable, call functions on our pool, and more.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Huma's SDK can be installed using npm or yarn.
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
npm install @huma-finance/sdk
|
|
11
|
+
yarn add @huma-finance/sdk
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
You'll also want to install Huma's shared utilities
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
npm install @huma-finance/shared
|
|
18
|
+
yarn add @huma-finance/shared
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Mint a Pool Receivable
|
|
22
|
+
|
|
23
|
+
Create a new file `index.js` and import services from `@huma-finance/sdk` and `@huma-finance/shared`
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
import { ReceivableService, PaymentMethod } from '@huma-finance/sdk'
|
|
27
|
+
import { POOL_NAME, POOL_TYPE } from "@huma-finance/shared";
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Set up your ethers Provider and import your private key
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
const TEST_PRIVATE_KEY = "YOUR_PRIVATE_KEY";
|
|
34
|
+
const provider = new ethers.providers.JsonRpcProvider(
|
|
35
|
+
`https://goerli.infura.io/v3/${INFURA_API_KEY}`,
|
|
36
|
+
{
|
|
37
|
+
name: "Goerli",
|
|
38
|
+
chainId: 5,
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Call on the `mintReceivable` method with an ethers Wallet instance
|
|
44
|
+
|
|
45
|
+
> Note: Receivables support multiple payment methods. Declarative receivables
|
|
46
|
+
> don't actually transfer ERC20 tokens, they just update their balance on-chain.
|
|
47
|
+
> Payable receivables will actually call pool methods to transfer ERC20 tokens.
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
const wallet = new Wallet(TEST_PRIVATE_KEY, provider);
|
|
51
|
+
const tx = await ReceivableService.mintReceivable(
|
|
52
|
+
wallet,
|
|
53
|
+
POOL_NAME.HumaCreditLine,
|
|
54
|
+
POOL_TYPE.CreditLine,
|
|
55
|
+
1000, // receivableAmount
|
|
56
|
+
1684517656, // maturityDate
|
|
57
|
+
PaymentMethod.Declarative, // paymentMethod
|
|
58
|
+
""
|
|
59
|
+
);
|
|
60
|
+
const data = await tx.wait();
|
|
61
|
+
console.log(`Success. Tx hash: ${data.transactionHash}`);
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Running this in the console, we should see the following result
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
$ node index.js
|
|
68
|
+
{}
|
|
69
|
+
Success. Tx hash: 0xb789af3611bc01b6a90f002327500421abf575660be1bbb30013d52518260e41
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Congrats! You've successfully minted your own receivable token, which are used to borrow from Huma's pools.
|
|
73
|
+
|
|
74
|
+
If you're stuck or want to view a complete solution, check out our `examples` directory (here)[https://github.com/00labs/huma-dapp/blob/develop/packages/examples/src/]
|
|
75
|
+
|
|
76
|
+
## Call functions from Huma's pool
|
|
77
|
+
|
|
78
|
+
We can use the Huma SDK to easily obtain ethers Contract instances of any Huma pool.
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
import { getPoolContract } from "@huma-finance/sdk";
|
|
82
|
+
import { POOL_NAME, POOL_TYPE } from "@huma-finance/shared";
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
With a ethers provider, pass in some config options for which pool contract you'd like to fetch.
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
const poolContract = getPoolContract(
|
|
89
|
+
wallet,
|
|
90
|
+
5, // Goerli chain ID
|
|
91
|
+
POOL_NAME.HumaCreditLine,
|
|
92
|
+
POOL_TYPE.CreditLine
|
|
93
|
+
);
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Now you can call any functions you want on the pool as if it were any other ethers Contract. Let's try fetching credit record details of our current account:
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
const data = await poolContract.creditRecordMapping(wallet.address);
|
|
100
|
+
console.log(data);
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Running this in the console, you should see something like this
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
$ node index.js
|
|
107
|
+
[
|
|
108
|
+
BigNumber { _hex: '0x00', _isBigNumber: true },
|
|
109
|
+
BigNumber { _hex: '0x00', _isBigNumber: true },
|
|
110
|
+
BigNumber { _hex: '0x00', _isBigNumber: true },
|
|
111
|
+
BigNumber { _hex: '0x00', _isBigNumber: true },
|
|
112
|
+
BigNumber { _hex: '0x00', _isBigNumber: true },
|
|
113
|
+
0,
|
|
114
|
+
0,
|
|
115
|
+
0,
|
|
116
|
+
unbilledPrincipal: BigNumber { _hex: '0x00', _isBigNumber: true },
|
|
117
|
+
dueDate: BigNumber { _hex: '0x00', _isBigNumber: true },
|
|
118
|
+
correction: BigNumber { _hex: '0x00', _isBigNumber: true },
|
|
119
|
+
totalDue: BigNumber { _hex: '0x00', _isBigNumber: true },
|
|
120
|
+
feesAndInterestDue: BigNumber { _hex: '0x00', _isBigNumber: true },
|
|
121
|
+
missedPeriods: 0,
|
|
122
|
+
remainingPeriods: 0,
|
|
123
|
+
state: 0
|
|
124
|
+
]
|
|
125
|
+
Done in 4.90s.
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
# Other SDK examples
|
|
129
|
+
|
|
130
|
+
## Declare a receivable as paid
|
|
131
|
+
|
|
132
|
+
Once we've minted a receivable, we can use the `ReceivableService` to pay it off using multiple types of payment methods.
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
const wallet = new Wallet(TEST_PRIVATE_KEY, provider);
|
|
136
|
+
|
|
137
|
+
const data = await ReceivableService.payReceivableByTokenId(
|
|
138
|
+
wallet,
|
|
139
|
+
8, // receivableTokenId
|
|
140
|
+
10, // paymentAmount
|
|
141
|
+
PaymentMethod.Declarative // paymentMethod
|
|
142
|
+
);
|
|
143
|
+
console.log(`Success. Tx hash: ${data.transactionHash}`);
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Mint a receivable with metadata automatically uploaded to ARWeave
|
|
147
|
+
|
|
148
|
+
Huma supports both lazy funding and pre-funding the ARWeave network to pay for metadata uploads.
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
// Prefund...
|
|
152
|
+
await prefundBundlr(getBundlrNetworkConfig(5), signer, 1_000_000)
|
|
153
|
+
|
|
154
|
+
// Or pay as you go! (Note: it's recommended you still prefund with a small
|
|
155
|
+
// amount of currency to avoid slippage)
|
|
156
|
+
const data = await ReceivableService.mintReceivableWithMetadata(
|
|
157
|
+
signer,
|
|
158
|
+
TEST_PRIVATE_KEY,
|
|
159
|
+
chainId,
|
|
160
|
+
poolName,
|
|
161
|
+
poolType,
|
|
162
|
+
receivableAmount,
|
|
163
|
+
maturityDate,
|
|
164
|
+
paymentMethod,
|
|
165
|
+
JSON.parse(metadata),
|
|
166
|
+
internalID,
|
|
167
|
+
[],
|
|
168
|
+
)
|
|
169
|
+
setMintResult(`Success, Tx Hash: ${data.transactionHash}`)
|
|
170
|
+
console.log(data)
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Query for receivables uploaded to ARWeave
|
|
174
|
+
|
|
175
|
+
Once metadata is uploaded to ARWeave, you can query them by referenceId tags, which you can specify during upload.
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
const data = await ARWeaveService.queryForMetadata(
|
|
179
|
+
chainId,
|
|
180
|
+
poolName,
|
|
181
|
+
poolType,
|
|
182
|
+
address,
|
|
183
|
+
'12', // referenceId
|
|
184
|
+
)
|
|
185
|
+
setQueryResult(data)
|
|
186
|
+
console.log(data)
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Next steps
|
|
190
|
+
|
|
191
191
|
If you want to learn more about the different functions and helpers available in the Huma SDK, please check out our [API documentation](API.md).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huma-finance/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.31",
|
|
4
4
|
"types": "./dist/index.d.ts",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -18,15 +18,16 @@
|
|
|
18
18
|
"prettier": "prettier --write \"src/**/*.{js,ts,tsx,graphql}\""
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@bundlr-network/client": "
|
|
21
|
+
"@bundlr-network/client": "0.11.9",
|
|
22
22
|
"@ethersproject/address": "^5.7.0",
|
|
23
23
|
"@ethersproject/bignumber": "^5.6.0",
|
|
24
24
|
"@ethersproject/constants": "^5.7.0",
|
|
25
25
|
"@ethersproject/contracts": "^5.7.0",
|
|
26
26
|
"@ethersproject/providers": "^5.6.0",
|
|
27
|
-
"@huma-finance/shared": "^0.0.
|
|
27
|
+
"@huma-finance/shared": "^0.0.31",
|
|
28
28
|
"arweave": "^1.13.5",
|
|
29
29
|
"axios": "^1.4.0",
|
|
30
|
+
"bignumber.js": "^9.1.1",
|
|
30
31
|
"ethers": "^5.7.2",
|
|
31
32
|
"graphql-request": "5.1.0",
|
|
32
33
|
"react": "^18.2.0",
|
|
@@ -42,6 +43,7 @@
|
|
|
42
43
|
"src/**/*.{js,ts,tsx,graphql}": [
|
|
43
44
|
"eslint --fix --max-warnings=0",
|
|
44
45
|
"prettier --write",
|
|
46
|
+
"yarn generateDocs",
|
|
45
47
|
"git add ."
|
|
46
48
|
]
|
|
47
49
|
},
|
|
@@ -91,5 +93,5 @@
|
|
|
91
93
|
"optionalDependencies": {
|
|
92
94
|
"encoding": "^0.1.13"
|
|
93
95
|
},
|
|
94
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "3725fd08e279365ab433ce005f594d951289c0ea"
|
|
95
97
|
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Contract, ethers } from 'ethers';
|
|
2
|
-
/**
|
|
3
|
-
* Returns an ethers contract instance for the BaseCreditPoolReceivable contract
|
|
4
|
-
* associated with the given pool name on the current chain.
|
|
5
|
-
*
|
|
6
|
-
* @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
|
|
7
|
-
* @param {number} chainId The chain id where the contract instance exists
|
|
8
|
-
* @returns {Contract | null} A contract instance for the BaseCreditPoolReceivable contract or null if it could not be found.
|
|
9
|
-
*/
|
|
10
|
-
export declare function getBaseCreditPoolReceivableContract(signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number): Contract | null;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getBaseCreditPoolReceivableContract = void 0;
|
|
4
|
-
const shared_1 = require("@huma-finance/shared");
|
|
5
|
-
const utils_1 = require("../utils");
|
|
6
|
-
/**
|
|
7
|
-
* Returns an ethers contract instance for the BaseCreditPoolReceivable contract
|
|
8
|
-
* associated with the given pool name on the current chain.
|
|
9
|
-
*
|
|
10
|
-
* @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
|
|
11
|
-
* @param {number} chainId The chain id where the contract instance exists
|
|
12
|
-
* @returns {Contract | null} A contract instance for the BaseCreditPoolReceivable contract or null if it could not be found.
|
|
13
|
-
*/
|
|
14
|
-
function getBaseCreditPoolReceivableContract(signerOrProvider, chainId) {
|
|
15
|
-
var _a;
|
|
16
|
-
const baseCreditPoolReceivable = (_a = shared_1.SupplementaryContractsMap[chainId]) === null || _a === void 0 ? void 0 : _a[shared_1.SupplementaryContracts.BaseCreditPoolReceivable];
|
|
17
|
-
if (!baseCreditPoolReceivable)
|
|
18
|
-
return null;
|
|
19
|
-
return (0, utils_1.getContract)(baseCreditPoolReceivable, shared_1.BASE_CREDIT_POOL_RECEIVABLE_ABI, signerOrProvider);
|
|
20
|
-
}
|
|
21
|
-
exports.getBaseCreditPoolReceivableContract = getBaseCreditPoolReceivableContract;
|
|
22
|
-
//# sourceMappingURL=BaseCreditPoolReceivableContractHelper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BaseCreditPoolReceivableContractHelper.js","sourceRoot":"","sources":["../../../src/helpers/BaseCreditPoolReceivableContractHelper.ts"],"names":[],"mappings":";;;AACA,iDAI6B;AAE7B,oCAAsC;AAEtC;;;;;;;GAOG;AACH,SAAgB,mCAAmC,CACjD,gBAA2D,EAC3D,OAAe;;IAEf,MAAM,wBAAwB,GAC5B,MAAA,kCAAyB,CAAC,OAAO,CAAC,0CAChC,+BAAsB,CAAC,wBAAwB,CAChD,CAAA;IAEH,IAAI,CAAC,wBAAwB;QAAE,OAAO,IAAI,CAAA;IAE1C,OAAO,IAAA,mBAAW,EAChB,wBAAwB,EACxB,wCAA+B,EAC/B,gBAAgB,CACjB,CAAA;AACH,CAAC;AAhBD,kFAgBC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Contract, ethers } from 'ethers';
|
|
2
|
-
/**
|
|
3
|
-
* A react hook that returns an ethers contract instance for the BaseCreditPoolReceivable contract
|
|
4
|
-
* associated with the given pool name on the current chain.
|
|
5
|
-
*
|
|
6
|
-
* @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
|
|
7
|
-
* @param {number} chainId The chain id where the contract instance exists
|
|
8
|
-
* @returns {Contract | null} A contract instance for the BaseCreditPoolReceivable contract or null if it could not be found.
|
|
9
|
-
*/
|
|
10
|
-
export declare function useBaseCreditPoolReceivableContract(signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number): Contract | null;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useBaseCreditPoolReceivableContract = void 0;
|
|
4
|
-
const shared_1 = require("@huma-finance/shared");
|
|
5
|
-
const useContract_1 = require("./useContract");
|
|
6
|
-
/**
|
|
7
|
-
* A react hook that returns an ethers contract instance for the BaseCreditPoolReceivable contract
|
|
8
|
-
* associated with the given pool name on the current chain.
|
|
9
|
-
*
|
|
10
|
-
* @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
|
|
11
|
-
* @param {number} chainId The chain id where the contract instance exists
|
|
12
|
-
* @returns {Contract | null} A contract instance for the BaseCreditPoolReceivable contract or null if it could not be found.
|
|
13
|
-
*/
|
|
14
|
-
function useBaseCreditPoolReceivableContract(signerOrProvider, chainId) {
|
|
15
|
-
var _a;
|
|
16
|
-
const baseCreditPoolReceivable = (_a = shared_1.SupplementaryContractsMap[chainId]) === null || _a === void 0 ? void 0 : _a[shared_1.SupplementaryContracts.BaseCreditPoolReceivable];
|
|
17
|
-
return (0, useContract_1.useContract)(baseCreditPoolReceivable, shared_1.BASE_CREDIT_POOL_RECEIVABLE_ABI, signerOrProvider);
|
|
18
|
-
}
|
|
19
|
-
exports.useBaseCreditPoolReceivableContract = useBaseCreditPoolReceivableContract;
|
|
20
|
-
//# sourceMappingURL=useBaseCreditPoolReceivableContract.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useBaseCreditPoolReceivableContract.js","sourceRoot":"","sources":["../../../src/hooks/useBaseCreditPoolReceivableContract.ts"],"names":[],"mappings":";;;AACA,iDAK6B;AAE7B,+CAA2C;AAE3C;;;;;;;GAOG;AACH,SAAgB,mCAAmC,CACjD,gBAA2D,EAC3D,OAAe;;IAEf,MAAM,wBAAwB,GAC5B,MAAA,kCAAyB,CAAC,OAAO,CAAC,0CAChC,+BAAsB,CAAC,wBAAwB,CAChD,CAAA;IAEH,OAAO,IAAA,yBAAW,EAChB,wBAAwB,EACxB,wCAA+B,EAC/B,gBAAgB,CACjB,CAAA;AACH,CAAC;AAdD,kFAcC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { POOL_NAME, ReceivableFactoringPool } from '@00labs/huma-shared';
|
|
2
|
-
import { ethers } from 'ethers';
|
|
3
|
-
/**
|
|
4
|
-
* A react hook that returns the instance of the ReceivableFactoringPool contract for a given signer or provider and pool name.
|
|
5
|
-
*
|
|
6
|
-
* @param {JsonRpcProvider | JsonRpcSigner} signerOrProvider - The signer or provider object to use for the contract.
|
|
7
|
-
* @param {POOL_NAME} poolName - The name of the pool to get the contract for. Check the type for more details.
|
|
8
|
-
* @returns {ReceivableFactoringPool} An ethers instance of the ReceivableFactoringPool contract.
|
|
9
|
-
*/
|
|
10
|
-
export declare function useReceivableFactoringPoolContract(signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number, poolName: POOL_NAME): ReceivableFactoringPool | null;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useReceivableFactoringPoolContract = void 0;
|
|
4
|
-
const huma_shared_1 = require("@00labs/huma-shared");
|
|
5
|
-
const usePoolContract_1 = require("./usePoolContract");
|
|
6
|
-
/**
|
|
7
|
-
* A react hook that returns the instance of the ReceivableFactoringPool contract for a given signer or provider and pool name.
|
|
8
|
-
*
|
|
9
|
-
* @param {JsonRpcProvider | JsonRpcSigner} signerOrProvider - The signer or provider object to use for the contract.
|
|
10
|
-
* @param {POOL_NAME} poolName - The name of the pool to get the contract for. Check the type for more details.
|
|
11
|
-
* @returns {ReceivableFactoringPool} An ethers instance of the ReceivableFactoringPool contract.
|
|
12
|
-
*/
|
|
13
|
-
function useReceivableFactoringPoolContract(signerOrProvider, chainId, poolName) {
|
|
14
|
-
return (0, usePoolContract_1.usePoolContract)(signerOrProvider, chainId, poolName, huma_shared_1.POOL_TYPE.Invoice);
|
|
15
|
-
}
|
|
16
|
-
exports.useReceivableFactoringPoolContract = useReceivableFactoringPoolContract;
|
|
17
|
-
//# sourceMappingURL=useReceivableFactoringPoolContract.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useReceivableFactoringPoolContract.js","sourceRoot":"","sources":["../../../src/hooks/useReceivableFactoringPoolContract.ts"],"names":[],"mappings":";;;AAAA,qDAI4B;AAG5B,uDAAmD;AAEnD;;;;;;GAMG;AACH,SAAgB,kCAAkC,CAChD,gBAA2D,EAC3D,OAAe,EACf,QAAmB;IAEnB,OAAO,IAAA,iCAAe,EACpB,gBAAgB,EAChB,OAAO,EACP,QAAQ,EACR,uBAAS,CAAC,OAAO,CAClB,CAAA;AACH,CAAC;AAXD,gFAWC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Contract, ethers } from 'ethers';
|
|
2
|
-
/**
|
|
3
|
-
* Returns an ethers contract instance for the BaseCreditPoolReceivable contract
|
|
4
|
-
* associated with the given pool name on the current chain.
|
|
5
|
-
*
|
|
6
|
-
* @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
|
|
7
|
-
* @param {number} chainId The chain id where the contract instance exists
|
|
8
|
-
* @returns {Contract | null} A contract instance for the BaseCreditPoolReceivable contract or null if it could not be found.
|
|
9
|
-
*/
|
|
10
|
-
export declare function getBaseCreditPoolReceivableContract(signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number): Contract | null;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { BASE_CREDIT_POOL_RECEIVABLE_ABI, SupplementaryContracts, SupplementaryContractsMap, } from '@huma-finance/shared';
|
|
2
|
-
import { getContract } from '../utils';
|
|
3
|
-
/**
|
|
4
|
-
* Returns an ethers contract instance for the BaseCreditPoolReceivable contract
|
|
5
|
-
* associated with the given pool name on the current chain.
|
|
6
|
-
*
|
|
7
|
-
* @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
|
|
8
|
-
* @param {number} chainId The chain id where the contract instance exists
|
|
9
|
-
* @returns {Contract | null} A contract instance for the BaseCreditPoolReceivable contract or null if it could not be found.
|
|
10
|
-
*/
|
|
11
|
-
export function getBaseCreditPoolReceivableContract(signerOrProvider, chainId) {
|
|
12
|
-
var _a;
|
|
13
|
-
const baseCreditPoolReceivable = (_a = SupplementaryContractsMap[chainId]) === null || _a === void 0 ? void 0 : _a[SupplementaryContracts.BaseCreditPoolReceivable];
|
|
14
|
-
if (!baseCreditPoolReceivable)
|
|
15
|
-
return null;
|
|
16
|
-
return getContract(baseCreditPoolReceivable, BASE_CREDIT_POOL_RECEIVABLE_ABI, signerOrProvider);
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=BaseCreditPoolReceivableContractHelper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BaseCreditPoolReceivableContractHelper.js","sourceRoot":"","sources":["../../src/helpers/BaseCreditPoolReceivableContractHelper.ts"],"names":[],"mappings":"AACA,OAAO,EACL,+BAA+B,EAC/B,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAEtC;;;;;;;GAOG;AACH,MAAM,UAAU,mCAAmC,CACjD,gBAA2D,EAC3D,OAAe;;IAEf,MAAM,wBAAwB,GAC5B,MAAA,yBAAyB,CAAC,OAAO,CAAC,0CAChC,sBAAsB,CAAC,wBAAwB,CAChD,CAAA;IAEH,IAAI,CAAC,wBAAwB;QAAE,OAAO,IAAI,CAAA;IAE1C,OAAO,WAAW,CAChB,wBAAwB,EACxB,+BAA+B,EAC/B,gBAAgB,CACjB,CAAA;AACH,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Contract, ethers } from 'ethers';
|
|
2
|
-
/**
|
|
3
|
-
* A react hook that returns an ethers contract instance for the BaseCreditPoolReceivable contract
|
|
4
|
-
* associated with the given pool name on the current chain.
|
|
5
|
-
*
|
|
6
|
-
* @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
|
|
7
|
-
* @param {number} chainId The chain id where the contract instance exists
|
|
8
|
-
* @returns {Contract | null} A contract instance for the BaseCreditPoolReceivable contract or null if it could not be found.
|
|
9
|
-
*/
|
|
10
|
-
export declare function useBaseCreditPoolReceivableContract(signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number): Contract | null;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { BASE_CREDIT_POOL_RECEIVABLE_ABI, SupplementaryContracts, SupplementaryContractsMap, } from '@huma-finance/shared';
|
|
2
|
-
import { useContract } from './useContract';
|
|
3
|
-
/**
|
|
4
|
-
* A react hook that returns an ethers contract instance for the BaseCreditPoolReceivable contract
|
|
5
|
-
* associated with the given pool name on the current chain.
|
|
6
|
-
*
|
|
7
|
-
* @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
|
|
8
|
-
* @param {number} chainId The chain id where the contract instance exists
|
|
9
|
-
* @returns {Contract | null} A contract instance for the BaseCreditPoolReceivable contract or null if it could not be found.
|
|
10
|
-
*/
|
|
11
|
-
export function useBaseCreditPoolReceivableContract(signerOrProvider, chainId) {
|
|
12
|
-
var _a;
|
|
13
|
-
const baseCreditPoolReceivable = (_a = SupplementaryContractsMap[chainId]) === null || _a === void 0 ? void 0 : _a[SupplementaryContracts.BaseCreditPoolReceivable];
|
|
14
|
-
return useContract(baseCreditPoolReceivable, BASE_CREDIT_POOL_RECEIVABLE_ABI, signerOrProvider);
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=useBaseCreditPoolReceivableContract.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useBaseCreditPoolReceivableContract.js","sourceRoot":"","sources":["../../src/hooks/useBaseCreditPoolReceivableContract.ts"],"names":[],"mappings":"AACA,OAAO,EACL,+BAA+B,EAE/B,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C;;;;;;;GAOG;AACH,MAAM,UAAU,mCAAmC,CACjD,gBAA2D,EAC3D,OAAe;;IAEf,MAAM,wBAAwB,GAC5B,MAAA,yBAAyB,CAAC,OAAO,CAAC,0CAChC,sBAAsB,CAAC,wBAAwB,CAChD,CAAA;IAEH,OAAO,WAAW,CAChB,wBAAwB,EACxB,+BAA+B,EAC/B,gBAAgB,CACjB,CAAA;AACH,CAAC"}
|
package/dist/hooks/usePool.d.ts
DELETED
|
File without changes
|
package/dist/hooks/usePool.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usePool.js","sourceRoot":"","sources":["../../src/hooks/usePool.ts"],"names":[],"mappings":""}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { POOL_NAME, ReceivableFactoringPool } from '@00labs/huma-shared';
|
|
2
|
-
import { ethers } from 'ethers';
|
|
3
|
-
/**
|
|
4
|
-
* A react hook that returns the instance of the ReceivableFactoringPool contract for a given signer or provider and pool name.
|
|
5
|
-
*
|
|
6
|
-
* @param {JsonRpcProvider | JsonRpcSigner} signerOrProvider - The signer or provider object to use for the contract.
|
|
7
|
-
* @param {POOL_NAME} poolName - The name of the pool to get the contract for. Check the type for more details.
|
|
8
|
-
* @returns {ReceivableFactoringPool} An ethers instance of the ReceivableFactoringPool contract.
|
|
9
|
-
*/
|
|
10
|
-
export declare function useReceivableFactoringPoolContract(signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number, poolName: POOL_NAME): ReceivableFactoringPool | null;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { POOL_TYPE, } from '@00labs/huma-shared';
|
|
2
|
-
import { usePoolContract } from './usePoolContract';
|
|
3
|
-
/**
|
|
4
|
-
* A react hook that returns the instance of the ReceivableFactoringPool contract for a given signer or provider and pool name.
|
|
5
|
-
*
|
|
6
|
-
* @param {JsonRpcProvider | JsonRpcSigner} signerOrProvider - The signer or provider object to use for the contract.
|
|
7
|
-
* @param {POOL_NAME} poolName - The name of the pool to get the contract for. Check the type for more details.
|
|
8
|
-
* @returns {ReceivableFactoringPool} An ethers instance of the ReceivableFactoringPool contract.
|
|
9
|
-
*/
|
|
10
|
-
export function useReceivableFactoringPoolContract(signerOrProvider, chainId, poolName) {
|
|
11
|
-
return usePoolContract(signerOrProvider, chainId, poolName, POOL_TYPE.Invoice);
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=useReceivableFactoringPoolContract.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useReceivableFactoringPoolContract.js","sourceRoot":"","sources":["../../src/hooks/useReceivableFactoringPoolContract.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,GAEV,MAAM,qBAAqB,CAAA;AAG5B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD;;;;;;GAMG;AACH,MAAM,UAAU,kCAAkC,CAChD,gBAA2D,EAC3D,OAAe,EACf,QAAmB;IAEnB,OAAO,eAAe,CACpB,gBAAgB,EAChB,OAAO,EACP,QAAQ,EACR,SAAS,CAAC,OAAO,CAClB,CAAA;AACH,CAAC"}
|