From 409127ef41bdc7bd08bfce5b69194b635d662584 Mon Sep 17 00:00:00 2001 From: Erdi Maden Date: Mon, 24 Jun 2024 15:27:56 -0500 Subject: [PATCH 1/2] Adding dynamic transaction links for faucet class --- src/client/api.ts | 8 +++++++- src/coinbase/faucet_transaction.ts | 3 +-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/client/api.ts b/src/client/api.ts index 178151c4..42961d70 100644 --- a/src/client/api.ts +++ b/src/client/api.ts @@ -362,7 +362,7 @@ export interface CreateWalletRequestWallet { 'use_server_signer'?: boolean; } /** - * + * The faucet transaction * @export * @interface FaucetTransaction */ @@ -373,6 +373,12 @@ export interface FaucetTransaction { * @memberof FaucetTransaction */ 'transaction_hash': string; + /** + * Link to the transaction on the blockchain explorer. + * @type {string} + * @memberof FaucetTransaction + */ + 'transaction_link': string; } /** * Features that can be enabled for a wallet diff --git a/src/coinbase/faucet_transaction.ts b/src/coinbase/faucet_transaction.ts index 8ef0e226..98a68c2e 100644 --- a/src/coinbase/faucet_transaction.ts +++ b/src/coinbase/faucet_transaction.ts @@ -37,8 +37,7 @@ export class FaucetTransaction { * @returns {string} The link to the transaction on the blockchain explorer */ public getTransactionLink(): string { - // TODO: Parameterize this by Network. - return `https://sepolia.basescan.org/tx/${this.getTransactionHash()}`; + return this.model.transaction_link; } /** From 9a687e57eb708215642e652338f7a624e2cea37b Mon Sep 17 00:00:00 2001 From: Erdi Maden Date: Mon, 24 Jun 2024 15:33:45 -0500 Subject: [PATCH 2/2] Fixing test cases --- src/coinbase/types.ts | 5 +---- src/tests/faucet_transaction_test.ts | 1 + 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/coinbase/types.ts b/src/coinbase/types.ts index 6c4b7c05..17b92eec 100644 --- a/src/coinbase/types.ts +++ b/src/coinbase/types.ts @@ -211,10 +211,7 @@ export type AddressAPIClient = { * @returns The transaction hash. * @throws {APIError} If the request fails. */ - requestFaucetFunds( - walletId: string, - addressId: string, - ): Promise<{ data: { transaction_hash: string } }>; + requestFaucetFunds(walletId: string, addressId: string): AxiosPromise; /** * Get address by onchain address. diff --git a/src/tests/faucet_transaction_test.ts b/src/tests/faucet_transaction_test.ts index b3074641..0d9df581 100644 --- a/src/tests/faucet_transaction_test.ts +++ b/src/tests/faucet_transaction_test.ts @@ -4,6 +4,7 @@ describe("FaucetTransaction tests", () => { it("should create a new FaucetTransaction instance and return the transaction hash", () => { const faucetTransaction = new FaucetTransaction({ transaction_hash: "abc", + transaction_link: "https://sepolia.basescan.org/tx/abc", }); expect(faucetTransaction).toBeInstanceOf(FaucetTransaction);