@carrot-protocol/http-client 0.2.26 → 0.2.27-refs1-dev-fdc2f8a

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/dist/index.d.ts CHANGED
@@ -12,6 +12,9 @@ export declare class Client {
12
12
  getHistoricalVaultApy(vault: anchor.web3.PublicKey, interval: VaultHistoricalApyInterval): Promise<HistoricalVaultApyResponse>;
13
13
  issue(vault: anchor.web3.PublicKey, assetMint: anchor.web3.PublicKey, amount: anchor.BN): Promise<string>;
14
14
  redeem(vault: anchor.web3.PublicKey, assetMint: anchor.web3.PublicKey, amount: anchor.BN): Promise<string>;
15
+ checkWallet(wallet: anchor.web3.PublicKey): Promise<boolean>;
16
+ claimReferralCode(wallet: anchor.web3.PublicKey, code: string): Promise<void>;
17
+ getReferralCodes(wallet: anchor.web3.PublicKey): Promise<string[]>;
15
18
  private send;
16
19
  }
17
20
  export interface SendRequest {
package/dist/index.js CHANGED
@@ -185,6 +185,41 @@ class Client {
185
185
  const txSig = await this.send(redeemResponse.tx);
186
186
  return txSig;
187
187
  }
188
+ async checkWallet(wallet) {
189
+ const url = new URL(`${this.baseUrl}/checkWallet?wallet=${wallet.toString()}`);
190
+ const response = await (0, cross_fetch_1.default)(url, {
191
+ method: "GET",
192
+ headers: this.headers,
193
+ });
194
+ checkResponse(response);
195
+ const responseBody = await response.json();
196
+ const isWalletValid = JSON.parse(JSON.stringify(responseBody));
197
+ return isWalletValid;
198
+ }
199
+ async claimReferralCode(wallet, code) {
200
+ const url = new URL(`${this.baseUrl}/claimReferralCode`);
201
+ const body = {
202
+ wallet: wallet.toString(),
203
+ code,
204
+ };
205
+ const response = await (0, cross_fetch_1.default)(url, {
206
+ method: "POST",
207
+ headers: this.headers,
208
+ body: JSON.stringify(body),
209
+ });
210
+ checkResponse(response);
211
+ }
212
+ async getReferralCodes(wallet) {
213
+ const url = new URL(`${this.baseUrl}/referralCodes?wallet=${wallet.toString()}`);
214
+ const response = await (0, cross_fetch_1.default)(url, {
215
+ method: "GET",
216
+ headers: this.headers,
217
+ });
218
+ checkResponse(response);
219
+ const responseBody = await response.json();
220
+ const referralCodes = JSON.parse(JSON.stringify(responseBody));
221
+ return referralCodes;
222
+ }
188
223
  async send(base64Tx) {
189
224
  // error if provider is undefined
190
225
  requireProvider(this.provider);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carrot-protocol/http-client",
3
- "version": "0.2.26",
3
+ "version": "0.2.27-refs1-dev-fdc2f8a",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",