-
Notifications
You must be signed in to change notification settings - Fork 106
/
Copy pathpartial.ts
34 lines (30 loc) · 879 Bytes
/
partial.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* eslint-disable @typescript-eslint/no-unused-vars */
import axios from 'axios';
import { ethers } from 'ethersV5';
import {
constructPartialSDK,
constructGetAdapters,
constructApproveToken,
constructEthersContractCaller,
constructAxiosFetcher,
} from '..';
const fetcher = constructAxiosFetcher(axios);
const provider = ethers.getDefaultProvider(1);
const contractCaller = constructEthersContractCaller({
ethersProviderOrSigner: provider,
EthersContract: ethers.Contract,
});
// type AdaptersFunctions & ApproveTokenFunctions<ethers.ContractTransaction>
const part1 = constructPartialSDK(
{
chainId: 1,
fetcher,
contractCaller,
},
constructGetAdapters,
constructApproveToken
);
// type Promise<AdaptersAsObject>
const res1 = part1.getAdapters();
// type Promise<ethers.ContractTransaction>
const res2 = part1.approveToken('123', '0x...');