Skip to content

Commit

Permalink
Feat/add explorer link to on transaction tracked callback (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
codingki authored Jul 25, 2024
1 parent 7e36fe6 commit f17527e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/slimy-penguins-cry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@skip-go/core': patch
---

add explorerLink to onTransactionTracked callback
19 changes: 10 additions & 9 deletions packages/core/src/client-types.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import { Coin, OfflineAminoSigner } from "@cosmjs/amino";
import { Coin, OfflineAminoSigner } from '@cosmjs/amino';
import {
GeneratedType,
OfflineDirectSigner,
OfflineSigner,
} from "@cosmjs/proto-signing";
} from '@cosmjs/proto-signing';
import {
AminoConverters,
GasPrice,
SignerData,
StdFee,
} from "@cosmjs/stargate";
} from '@cosmjs/stargate';

import { WalletClient } from "viem";
import { WalletClient } from 'viem';

import * as types from "./types";
import { Adapter } from "@solana/wallet-adapter-base";
import * as types from './types';
import { Adapter } from '@solana/wallet-adapter-base';

export interface UserAddress {
chainID: string;
Expand Down Expand Up @@ -57,11 +57,12 @@ export type ExecuteRouteOptions = {
onTransactionTracked?: (txInfo: {
txHash: string;
chainID: string;
explorerLink: string;
}) => Promise<void>;
onTransactionCompleted?: (
chainID: string,
txHash: string,
status: types.TxStatusResponse,
status: types.TxStatusResponse
) => Promise<void>;
validateGasBalance?: boolean;
slippageTolerancePercent?: string;
Expand Down Expand Up @@ -120,10 +121,10 @@ export type SignCosmosMessageAminoOptions = {

export type GetFallbackGasAmount = (
chainID: string,
chainType: "cosmos" | "evm" | "svm",
chainType: 'cosmos' | 'evm' | 'svm'
) => Promise<number | undefined>;

export type GetGasPrice = (
chainID: string,
chainType: "cosmos" | "evm" | "svm",
chainType: 'cosmos' | 'evm' | 'svm'
) => Promise<GasPrice | undefined>;
5 changes: 3 additions & 2 deletions packages/core/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1302,9 +1302,10 @@ export class SkipRouter {
onTransactionTracked?: (txInfo: {
txHash: string;
chainID: string;
explorerLink: string;
}) => Promise<void>;
}) {
await this.trackTransaction({
const { explorerLink } = await this.trackTransaction({
chainID,
txHash,
options: {
Expand All @@ -1314,7 +1315,7 @@ export class SkipRouter {
},
});
if (onTransactionTracked) {
await onTransactionTracked({ txHash, chainID });
await onTransactionTracked({ txHash, chainID, explorerLink });
}
// eslint-disable-next-line no-constant-condition
while (true) {
Expand Down

0 comments on commit f17527e

Please sign in to comment.