Skip to content

Commit

Permalink
Merge pull request #83 from coinbase/feat/dynamic-faucet-transaction-…
Browse files Browse the repository at this point in the history
…links

Dynamic faucet transaction links
  • Loading branch information
erdimaden authored Jun 24, 2024
2 parents 67cd1b8 + 9a687e5 commit 05e9f92
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
8 changes: 7 additions & 1 deletion src/client/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ export interface CreateWalletRequestWallet {
'use_server_signer'?: boolean;
}
/**
*
* The faucet transaction
* @export
* @interface FaucetTransaction
*/
Expand All @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/coinbase/faucet_transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
5 changes: 1 addition & 4 deletions src/coinbase/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,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<FaucetTransaction>;

/**
* Get address by onchain address.
Expand Down
1 change: 1 addition & 0 deletions src/tests/faucet_transaction_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 05e9f92

Please sign in to comment.