@dripfi/drip-sdk 1.0.8 → 1.0.9
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 +39 -36
- package/package.json +1 -1
package/README.md
CHANGED
@@ -30,7 +30,46 @@ const dripConfig = new DripConfig(
|
|
30
30
|
dripRoute: string);
|
31
31
|
const signer: ethers.Signer = /* your Signer instance */;
|
32
32
|
const dripSdk = new DripSdk(dripConfig, signer);
|
33
|
+
```
|
34
|
+
|
35
|
+
## Methods
|
36
|
+
|
37
|
+
- `getAllVaults(): Promise<Vault[]>`
|
38
|
+
Fetches details of all Drip Vaults.
|
39
|
+
|
40
|
+
- `getVaultDetails(vaultAddress: string): Promise<Vault> `
|
41
|
+
Fetches details of a specific Drip Vault identified by its address.
|
42
|
+
|
43
|
+
- `authenticate(): Promise<boolean>`
|
44
|
+
Initiates the user authentication process and returns a boolean indicating success.
|
45
|
+
|
46
|
+
- `isUserAuthenticated(): Promise<AuthenticationStatus>`
|
47
|
+
Checks if the user is authenticated and returns authentication status along with relevant information.
|
48
|
+
|
49
|
+
- `updateSigner(newSigner: Signer): Promise<void>`
|
50
|
+
Updates the signer for the SDK instance.
|
51
|
+
|
52
|
+
- `getUserBalance(vault: Vault): Promise<UserBalance>`
|
53
|
+
Fetches the user's balance for a specific Drip Vault.
|
54
|
+
|
55
|
+
- `deposit(tokenAddress: string, vaultAddress: string, amount: string): Promise<void>`
|
56
|
+
The deposit function allows you to deposit tokens into a specific vault.
|
57
|
+
|
58
|
+
- `swapAndDeposit(fromTokenAddress: string, toTokenAddress: string, fromTokenAmount: string, vaultAddress: string, ethAmount?: string): Promise<void>`
|
59
|
+
The swapAndDeposit function allows you to deposit a different token or ether and it will take care of swapping to the correct token before making the deposit
|
60
|
+
|
61
|
+
- `withdraw(vault: Vault, amountToWithdraw?: string): Promise<void>`
|
62
|
+
Withdraws tokens from a vault. After withdrawing, you must wait for the withdrawal to be processed by the 'DoHardWork' function, and then you can claim those tokens using claimWithdraws()
|
63
|
+
|
64
|
+
- `claimWithdraws(vaultAddress: string): Promise<void>`
|
65
|
+
After the withdrawal has been processed by the 'DoHardWork' function, the 'claimWithdraws' function transfers the withdrawn tokens to their personal account.
|
66
|
+
|
67
|
+
- `fastWithdraw(vault: Vault, amountToWithdraw?: string): Promise<void>`
|
68
|
+
For users who prefer not to wait for withdrawals to be processed, there is a Fast Withdrawal method. While this approach is more gas-intensive, as users bear the cost of executing the withdrawal process themselves, it allows for instant access to the withdrawn tokens. When utilizing Fast Withdrawal, users immediately receive the tokens, eliminating the need to initiate the 'claimWithdrawal' process separately.
|
69
|
+
|
70
|
+
## Types
|
33
71
|
|
72
|
+
```
|
34
73
|
type Vault = {
|
35
74
|
vaultName: string
|
36
75
|
vaultAddress: string
|
@@ -128,40 +167,4 @@ type SwapInfo = {
|
|
128
167
|
token: string
|
129
168
|
swapCallData: any
|
130
169
|
}
|
131
|
-
|
132
170
|
```
|
133
|
-
|
134
|
-
## Methods
|
135
|
-
|
136
|
-
- `getAllVaults(): Promise<Vault[]>`
|
137
|
-
Fetches details of all Drip Vaults.
|
138
|
-
|
139
|
-
- `getVaultDetails(vaultAddress: string): Promise<Vault> `
|
140
|
-
Fetches details of a specific Drip Vault identified by its address.
|
141
|
-
|
142
|
-
- `authenticate(): Promise<boolean>`
|
143
|
-
Initiates the user authentication process and returns a boolean indicating success.
|
144
|
-
|
145
|
-
- `isUserAuthenticated(): Promise<AuthenticationStatus>`
|
146
|
-
Checks if the user is authenticated and returns authentication status along with relevant information.
|
147
|
-
|
148
|
-
- `updateSigner(newSigner: Signer): Promise<void>`
|
149
|
-
Updates the signer for the SDK instance.
|
150
|
-
|
151
|
-
- `getUserBalance(vault: Vault): Promise<UserBalance>`
|
152
|
-
Fetches the user's balance for a specific Drip Vault.
|
153
|
-
|
154
|
-
- `deposit(tokenAddress: string, vaultAddress: string, amount: string): Promise<void>`
|
155
|
-
The deposit function allows you to deposit tokens into a specific vault.
|
156
|
-
|
157
|
-
- `swapAndDeposit(fromTokenAddress: string, toTokenAddress: string, fromTokenAmount: string, vaultAddress: string, ethAmount?: string): Promise<void>`
|
158
|
-
The swapAndDeposit function allows you to deposit a different token or ether and it will take care of swapping to the correct token before making the deposit
|
159
|
-
|
160
|
-
- `withdraw(vault: Vault, amountToWithdraw?: string): Promise<void>`
|
161
|
-
Withdraws tokens from a vault. After withdrawing, you must wait for the withdrawal to be processed by the 'DoHardWork' function, and then you can claim those tokens using claimWithdraws()
|
162
|
-
|
163
|
-
- `claimWithdraws(vaultAddress: string): Promise<void>`
|
164
|
-
After the withdrawal has been processed by the 'DoHardWork' function, the 'claimWithdraws' function transfers the withdrawn tokens to their personal account.
|
165
|
-
|
166
|
-
- `fastWithdraw(vault: Vault, amountToWithdraw?: string): Promise<void>`
|
167
|
-
For users who prefer not to wait for withdrawals to be processed, there is a Fast Withdrawal method. While this approach is more gas-intensive, as users bear the cost of executing the withdrawal process themselves, it allows for instant access to the withdrawn tokens. When utilizing Fast Withdrawal, users immediately receive the tokens, eliminating the need to initiate the 'claimWithdrawal' process separately.
|