@carrot-protocol/http-client 0.2.27-refs1-dev-1802f0b → 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 +1 -0
- package/dist/index.js +11 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export declare class Client {
|
|
|
14
14
|
redeem(vault: anchor.web3.PublicKey, assetMint: anchor.web3.PublicKey, amount: anchor.BN): Promise<string>;
|
|
15
15
|
checkWallet(wallet: anchor.web3.PublicKey): Promise<boolean>;
|
|
16
16
|
claimReferralCode(wallet: anchor.web3.PublicKey, code: string): Promise<void>;
|
|
17
|
+
getReferralCodes(wallet: anchor.web3.PublicKey): Promise<string[]>;
|
|
17
18
|
private send;
|
|
18
19
|
}
|
|
19
20
|
export interface SendRequest {
|
package/dist/index.js
CHANGED
|
@@ -209,6 +209,17 @@ class Client {
|
|
|
209
209
|
});
|
|
210
210
|
checkResponse(response);
|
|
211
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
|
+
}
|
|
212
223
|
async send(base64Tx) {
|
|
213
224
|
// error if provider is undefined
|
|
214
225
|
requireProvider(this.provider);
|