@dripfi/drip-sdk 1.1.28 → 1.2.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 +8 -8
- package/dist/DripConfig.d.ts +6 -2
- package/dist/DripConfig.js +29 -6
- package/dist/DripSdk.d.ts +2 -2
- package/dist/DripSdk.js +6 -6
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/test.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
@@ -23,20 +23,20 @@ npm i @dripfi/drip-sdk
|
|
23
23
|
|
24
24
|
```typescript
|
25
25
|
import DripSdk from '@drip/sdk'
|
26
|
+
import { DripConfig, Chain } from '@dripfi/drip-sdk'
|
26
27
|
```
|
27
28
|
|
28
29
|
Initialize the SDK with your Drip configuration and an optional signer:
|
29
30
|
|
30
31
|
```typescript
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
contracts: Record<number, ContractAddresses>,
|
37
|
-
dripRoute: string);
|
32
|
+
|
33
|
+
const chain: Chain = Chain.MAINNET // if targeting ethereum mainnet
|
34
|
+
|
35
|
+
const chain: Chain = Chain.SEPOLIA // if targeting sepolia testnet
|
36
|
+
|
38
37
|
const signer: ethers.Signer = /* your Signer instance */;
|
39
|
-
|
38
|
+
|
39
|
+
const dripSdk = new DripSdk(chain, signer);
|
40
40
|
```
|
41
41
|
|
42
42
|
# Methods
|
package/dist/DripConfig.d.ts
CHANGED
@@ -1,7 +1,11 @@
|
|
1
|
-
import {
|
1
|
+
import { SDKConfig } from '@spool.fi/spool-v2-sdk';
|
2
2
|
import { Signer } from 'ethers';
|
3
3
|
export declare const NULL_ADDRESS = "0x0000000000000000000000000000000000000000";
|
4
4
|
export declare const DRIP_TOKEN_DECIMALS = 18;
|
5
|
+
export declare enum Chain {
|
6
|
+
MAINNET = "mainnet",
|
7
|
+
SEPOLIA = "sepolia"
|
8
|
+
}
|
5
9
|
export declare class DripConfig {
|
6
10
|
internalConfig: SDKConfig;
|
7
11
|
dripRoute: string;
|
@@ -9,7 +13,7 @@ export declare class DripConfig {
|
|
9
13
|
smartVaultManagerAddress: string | undefined;
|
10
14
|
dripTokenAddress: string;
|
11
15
|
dripTokenRecyclerAddress: string;
|
12
|
-
constructor(
|
16
|
+
constructor(chain: Chain, dripRoute?: string);
|
13
17
|
getSwapAndDepositContractAddress(signer: Signer): Promise<string>;
|
14
18
|
getSmartVaultManagerAddress(signer: Signer): Promise<string>;
|
15
19
|
}
|
package/dist/DripConfig.js
CHANGED
@@ -9,16 +9,39 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
9
9
|
});
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
exports.DripConfig = exports.DRIP_TOKEN_DECIMALS = exports.NULL_ADDRESS = void 0;
|
12
|
+
exports.DripConfig = exports.Chain = exports.DRIP_TOKEN_DECIMALS = exports.NULL_ADDRESS = void 0;
|
13
13
|
const spool_v2_sdk_1 = require("@spool.fi/spool-v2-sdk");
|
14
14
|
exports.NULL_ADDRESS = '0x0000000000000000000000000000000000000000';
|
15
15
|
exports.DRIP_TOKEN_DECIMALS = 18;
|
16
|
+
var Chain;
|
17
|
+
(function (Chain) {
|
18
|
+
Chain["MAINNET"] = "mainnet";
|
19
|
+
Chain["SEPOLIA"] = "sepolia";
|
20
|
+
})(Chain || (exports.Chain = Chain = {}));
|
21
|
+
const SUBGRAPH_URL_SEPOLIA = 'https://subgraph.satsuma-prod.com/49eb322da234/solidant/spool-v2-sepolia/api';
|
22
|
+
const RECYCLER_ADDRESS_SEPOLIA = '0x463aea273644AfF560da07c7c09f3142b87E12f1';
|
23
|
+
const DRIP_TOKEN_ADDRESS_SEPOLIA = '0xc9C66052327523d6A7a2ee5D50CF07e4415e27c7';
|
24
|
+
const SUBGRAPH_URL_MAINNET = 'https://subgraph.satsuma-prod.com/49eb322da234/solidant/spool-v2/api';
|
25
|
+
// const RECYCLER_ADDRESS_MAINNET = '';
|
26
|
+
// const DRIP_TOKEN_ADDRESS_MAINNET = '';
|
27
|
+
const DEV_BACKEND_ROUTE = 'https://dev.drip.fi.io';
|
28
|
+
const PROD_BACKEND_ROUTE = 'https://perq.finance';
|
16
29
|
class DripConfig {
|
17
|
-
constructor(
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
30
|
+
constructor(chain, dripRoute) {
|
31
|
+
switch (chain) {
|
32
|
+
case Chain.MAINNET:
|
33
|
+
this.internalConfig = (0, spool_v2_sdk_1.getMainnetConfig)(SUBGRAPH_URL_MAINNET);
|
34
|
+
this.dripRoute = dripRoute !== undefined ? dripRoute : PROD_BACKEND_ROUTE;
|
35
|
+
this.dripTokenAddress = exports.NULL_ADDRESS;
|
36
|
+
this.dripTokenRecyclerAddress = exports.NULL_ADDRESS;
|
37
|
+
break;
|
38
|
+
case Chain.SEPOLIA:
|
39
|
+
this.internalConfig = (0, spool_v2_sdk_1.getSepoliaConfig)(SUBGRAPH_URL_SEPOLIA);
|
40
|
+
this.dripRoute = dripRoute !== undefined ? dripRoute : DEV_BACKEND_ROUTE;
|
41
|
+
this.dripTokenAddress = DRIP_TOKEN_ADDRESS_SEPOLIA;
|
42
|
+
this.dripTokenRecyclerAddress = RECYCLER_ADDRESS_SEPOLIA;
|
43
|
+
break;
|
44
|
+
}
|
22
45
|
}
|
23
46
|
getSwapAndDepositContractAddress(signer) {
|
24
47
|
return __awaiter(this, void 0, void 0, function* () {
|
package/dist/DripSdk.d.ts
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
import { Signer } from 'ethers';
|
2
|
-
import { DripConfig } from './DripConfig';
|
3
2
|
import { AuthenticationStatus } from './types/AuthenticationStatus';
|
4
3
|
import { UserRewards } from './types/UserRewards';
|
5
4
|
import { VaultStats } from './types/VaultStats';
|
@@ -9,6 +8,7 @@ import { VaultClaimData } from './types/VaultClaimData';
|
|
9
8
|
import { Vault } from './types/Vault';
|
10
9
|
import { LoyaltyCard } from './types/LoyaltyCard';
|
11
10
|
import MyPerqData from './types/MyPerqData';
|
11
|
+
import { Chain } from './DripConfig';
|
12
12
|
export default class DripSdk {
|
13
13
|
private dripApi;
|
14
14
|
private dripTokenContract;
|
@@ -16,7 +16,7 @@ export default class DripSdk {
|
|
16
16
|
private spoolSdk?;
|
17
17
|
private signer?;
|
18
18
|
private dripConfig;
|
19
|
-
constructor(
|
19
|
+
constructor(chain: Chain, signer?: Signer, dripRoute?: string);
|
20
20
|
getAllVaults(): Promise<Vault[]>;
|
21
21
|
getVaultDetails(vaultAddress: string): Promise<Vault>;
|
22
22
|
getVaultStats(): Promise<VaultStats>;
|
package/dist/DripSdk.js
CHANGED
@@ -21,15 +21,15 @@ const js_cookie_1 = __importDefault(require("js-cookie"));
|
|
21
21
|
const DripTokenContract_1 = __importDefault(require("./contracts/DripTokenContract"));
|
22
22
|
const DripTokenRecyclerContract_1 = __importDefault(require("./contracts/DripTokenRecyclerContract"));
|
23
23
|
class DripSdk {
|
24
|
-
constructor(
|
24
|
+
constructor(chain, signer, dripRoute) {
|
25
25
|
this.signer = signer;
|
26
|
-
this.dripConfig =
|
26
|
+
this.dripConfig = new DripConfig_1.DripConfig(chain, dripRoute);
|
27
27
|
if (signer) {
|
28
|
-
this.spoolSdk = new spool_v2_sdk_1.SpoolSdk(dripConfig.internalConfig, signer);
|
28
|
+
this.spoolSdk = new spool_v2_sdk_1.SpoolSdk(this.dripConfig.internalConfig, signer);
|
29
29
|
}
|
30
|
-
this.dripApi = new DripApi_1.default(dripConfig.dripRoute);
|
31
|
-
this.dripTokenContract = new DripTokenContract_1.default(dripConfig.dripTokenAddress, signer);
|
32
|
-
this.dripTokenRecyclerContract = new DripTokenRecyclerContract_1.default(dripConfig.dripTokenRecyclerAddress, signer);
|
30
|
+
this.dripApi = new DripApi_1.default(this.dripConfig.dripRoute);
|
31
|
+
this.dripTokenContract = new DripTokenContract_1.default(this.dripConfig.dripTokenAddress, signer);
|
32
|
+
this.dripTokenRecyclerContract = new DripTokenRecyclerContract_1.default(this.dripConfig.dripTokenRecyclerAddress, signer);
|
33
33
|
}
|
34
34
|
getAllVaults() {
|
35
35
|
return __awaiter(this, void 0, void 0, function* () {
|
package/dist/index.d.ts
CHANGED
@@ -11,6 +11,6 @@ import { VaultType } from './types/VaultType';
|
|
11
11
|
import { UserVaultBalance } from './types/UserVaultBalance';
|
12
12
|
import { UserBalance } from './types/UserBalance';
|
13
13
|
import { VaultStats } from './types/VaultStats';
|
14
|
-
import {
|
14
|
+
import { Chain } from './DripConfig';
|
15
15
|
import MyPerqData from './types/MyPerqData';
|
16
|
-
export { Vault, VaultReward, DripSdk,
|
16
|
+
export { Vault, VaultReward, DripSdk, UserVaultBalance, UserBalance, VaultStats, AuthenticationStatus, NFTBoost, Strategy, StretchGoal, SwapInfo, VaultDepositToken, VaultType, MyPerqData, Chain };
|
package/dist/index.js
CHANGED
@@ -3,8 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.
|
6
|
+
exports.Chain = exports.DripSdk = void 0;
|
7
7
|
const DripSdk_1 = __importDefault(require("./DripSdk"));
|
8
8
|
exports.DripSdk = DripSdk_1.default;
|
9
9
|
const DripConfig_1 = require("./DripConfig");
|
10
|
-
Object.defineProperty(exports, "
|
10
|
+
Object.defineProperty(exports, "Chain", { enumerable: true, get: function () { return DripConfig_1.Chain; } });
|
package/dist/test.js
CHANGED
@@ -70,7 +70,7 @@ const daiVaultPerq = '0x1977efe478ba17da8be6e93fdfadbd3055d30111'; // DAI PERQ S
|
|
70
70
|
const usdcVaultPerq = '0xf9795bfbf7c40981c372d0fb25a87e0b694c4fcd'; // USDC PERQ SEPOLIA
|
71
71
|
const daiTokenAddress = '0x2a3a3872c242c35093a8fc48dac838c4b2d24a03'; // DAI TOKEN
|
72
72
|
const usdcTokenAddress = '0xa6b92fcd4ee124353c8a6acf1edb574f46f3f8df'; // USDC TOKEN
|
73
|
-
const dripSdk = new DripSdk_1.default(
|
73
|
+
const dripSdk = new DripSdk_1.default(DripConfig_1.Chain.SEPOLIA, exports.signer, 'https://localhost:3000');
|
74
74
|
// 0x689Baa4821865Cb328F5E847fB6133DEB315A832
|
75
75
|
// 0x9E9B6899Ea314dD553A99f4F49440d2CeD2b2848
|
76
76
|
function main() {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@dripfi/drip-sdk",
|
3
|
-
"version": "1.1
|
3
|
+
"version": "1.2.1",
|
4
4
|
"description": "Drip SDK",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"types": "dist/index.d.ts",
|
@@ -11,7 +11,7 @@
|
|
11
11
|
"test": "echo \"Error: no test specified\" && exit 1"
|
12
12
|
},
|
13
13
|
"dependencies": {
|
14
|
-
"@spool.fi/spool-v2-sdk": "
|
14
|
+
"@spool.fi/spool-v2-sdk": "2.0.31",
|
15
15
|
"ethers": "^5.7.2",
|
16
16
|
"js-cookie": "^3.0.5",
|
17
17
|
"web3-token": "^1.0.6"
|