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

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,8 @@ 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>;
15
17
  private send;
16
18
  }
17
19
  export interface SendRequest {
package/dist/index.js CHANGED
@@ -185,6 +185,30 @@ 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
+ }
188
212
  async send(base64Tx) {
189
213
  // error if provider is undefined
190
214
  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-1802f0b",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",