Skip to content
This repository was archived by the owner on Jul 1, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions lib/http-client-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,13 +549,6 @@ export class HttpClient {
return this.instance.get(path, requestConfig);
}

public baseCoinBalanceOfWallet(
walletAddress: string,
): Promise<GenericResponse<BaseCoinBalance>> {
const path = `/v1/wallets/${walletAddress}/base-coin`;
return this.instance.get(path);
}

public issueServiceToken(
request: IssueServiceTokenRequest,
): Promise<GenericResponse<TxHashResponse>> {
Expand Down Expand Up @@ -642,14 +635,6 @@ export class HttpClient {
return this.instance.get(path);
}

public transferBaseCoinOfWallet(
walletAddress: string,
request: TransferBaseCoinRequest,
): Promise<GenericResponse<TxHashResponse>> {
const path = `/v1/wallets/${walletAddress}/base-coin/transfer`;
return this.instance.post(path, request);
}

public transferServiceTokenOfWallet(
walletAddress: string,
contractId: string,
Expand Down Expand Up @@ -707,13 +692,6 @@ export class HttpClient {
return this.instance.get(path, requestConfig);
}

public baseCoinBalanceOfUser(
userId: string,
): Promise<GenericResponse<BaseCoinBalance>> {
const path = `/v1/users/${userId}/base-coin`;
return this.instance.get(path);
}

public serviceTokenBalancesOfUser(
userId: string,
pageRequest: PageRequest,
Expand Down Expand Up @@ -957,16 +935,6 @@ export class HttpClient {
return this.instance.get(path);
}

public issueSessionTokenForBaseCoinTransfer(
userId: string,
requestType: RequestType,
request: IssueTransferSessionTokenRequest,
): Promise<GenericResponse<SessionTokenResponse>> {
const path = `/v1/users/${userId}/base-coin/request-transfer`;
const requestTypeParam = this.requestTypeParam(requestType);
return this.instance.post(path, request, requestTypeParam);
}

public issueSessionTokenForServiceTokenTransfer(
userId: string,
contractId: string,
Expand Down
103 changes: 0 additions & 103 deletions test/http-client-base.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1445,33 +1445,6 @@ describe("http-client-base test", () => {
expect(response["responseData"][0]["txhash"]).to.equal(testTxHash);
});

it("base-coin balance of wallet api test", async () => {
const testAddress = "tlink1nf5uhdmtsshmkqvlmq45kn4q9atnkx4l3u4rww";
const receivedData = {
responseTime: 1585467716718,
statusCode: 1000,
statusMessage: "Success",
responseData: {
symbol: "TC",
decimals: 6,
amount: "1000000",
},
};

stub = new MockAdapter(httpClient.getAxiosInstance());

stub.onGet(`/v1/wallets/${testAddress}/base-coin`).reply(config => {
assertHeaders(config.headers);
return [200, receivedData];
});

const response = await httpClient.baseCoinBalanceOfWallet(testAddress);
expect(response["statusCode"]).to.equal(1000);
expect(response["responseData"]["symbol"]).to.equal("TC");
expect(response["responseData"]["decimals"]).to.equal(6);
expect(response["responseData"]["amount"]).to.equal("1000000");
});

it("service-token balances of wallet api test", async () => {
const testAddress = "tlink1nf5uhdmtsshmkqvlmq45kn4q9atnkx4l3u4rww";
const pageRequest = new PageRequest(0, 10, OrderBy.DESC);
Expand Down Expand Up @@ -1731,43 +1704,6 @@ describe("http-client-base test", () => {
expect(response["responseData"]["tokenIndex"]).to.equal(testTokenIndex);
});

it("tranfer base-coin of wallet api test", async () => {
const testAddress = "tlink1nf5uhdmtsshmkqvlmq45kn4q9atnkx4l3u4rww";
const request = {
walletSecret: "PCSO7JBIH1gWPNNR5vT58Hr2SycFSUb9nzpNapNjJFU=",
toAddress: "tlink1s658utvasn7f5q92034h6zgv0zh2uxy9tzmtqv",
amount: "15",
};

const testTxHash =
"22DF78611396824D293AF7ABA04A2A646B1E3055A19B32E731D8E03BAE743661";
const receivedData = {
responseTime: 1585467711877,
statusCode: 1002,
statusMessage: "Accepted",
responseData: {
txHash: testTxHash,
},
};

stub = new MockAdapter(httpClient.getAxiosInstance());

stub
.onPost(`/v1/wallets/${testAddress}/base-coin/transfer`)
.reply(config => {
assertHeaders(config.headers);
expect(config.data).to.equal(JSON.stringify(request));
return [200, receivedData];
});

const response = await httpClient.transferBaseCoinOfWallet(
testAddress,
request,
);
expect(response["statusCode"]).to.equal(1002);
expect(response["responseData"]["txHash"]).to.equal(testTxHash);
});

it("tranfer service-token of wallet api test", async () => {
const testAddress = "tlink1nf5uhdmtsshmkqvlmq45kn4q9atnkx4l3u4rww";
const testContractId = "9636a07e";
Expand Down Expand Up @@ -2428,45 +2364,6 @@ describe("http-client-base test", () => {
expect(response["responseData"]["txHash"]).to.equal(testTxHash);
});

it("issue session-token of a user for base-coin transfer api test", async () => {
const testUserId = "U556719f559479aab8b8f74c488bf6317";
const testRequestSessionToken = "J4EDHA_oyCyXrtREGS4MpyoGeus";
const request = {
toAddress: "tlink1s658utvasn7f5q92034h6zgv0zh2uxy9tzmtqv",
amount: "15",
landingUri: "https://my.service.landing/home",
};

const receivedData = {
responseTime: 1585484513052,
statusCode: 1000,
statusMessage: "Success",
responseData: {
requestSessionToken: testRequestSessionToken,
redirectUri: null,
},
};

stub = new MockAdapter(httpClient.getAxiosInstance());

const path = `/v1/users/${testUserId}/base-coin/request-transfer`;
stub.onPost(path).reply(config => {
assertHeaders(config.headers);
expect(config.data).to.equal(JSON.stringify(request));
return [200, receivedData];
});

const response = await httpClient.issueSessionTokenForBaseCoinTransfer(
testUserId,
RequestType.AOA,
request,
);
expect(response["statusCode"]).to.equal(1000);
expect(response["responseData"]["requestSessionToken"]).to.equal(
testRequestSessionToken,
);
});

it("issue session-token of a user for service-token transfer api test", async () => {
const testUserId = "U556719f559479aab8b8f74c488bf6317";
const testContractId = "9636a07e";
Expand Down