Skip to content

Commit

Permalink
replace pact-lang-api in getTransactionStatus; remove pect-lang-api
Browse files Browse the repository at this point in the history
  • Loading branch information
Takadenoshi committed Jan 22, 2024
1 parent 3824b99 commit 5a56203
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 606 deletions.
1 change: 0 additions & 1 deletion packages/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
"memoize-one": "^6.0.0",
"moment": "^2.29.4",
"nanoevents": "^7.0.1",
"pact-lang-api": "^4.3.6",
"pinia": "^2.1.6",
"qrcode.vue": "^3.4.1",
"switch-ts": "^1.1.1",
Expand Down
14 changes: 9 additions & 5 deletions packages/extension/src/providers/kadena/libs/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,16 @@ class API implements ProviderAPIInterface {
});
}

async getTransactionStatus(hash: string): Promise<KadenaRawInfo | null> {
const Pact = require("pact-lang-api");
const cmd = { requestKeys: [hash] };
async getTransactionStatus(requestKey: string): Promise<KadenaRawInfo> {
const chainId = await this.getChainId();
const transactions = await Pact.fetch.poll(cmd, this.getApiHost(chainId));
return transactions[hash];
const networkId = this.networkId;
const { pollStatus } = createClient(this.getApiHost(chainId));
const responses = await pollStatus({
requestKey,
networkId,
chainId: chainId as ChainId,
});
return responses[requestKey];
}

async getBalanceByChainId(address: string, chainId: string): Promise<string> {
Expand Down
9 changes: 2 additions & 7 deletions packages/extension/src/types/activity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
TokenTypeTo,
StatusOptionsResponse,
} from "@enkryptcom/swap";
import { ICommandResult } from "@kadena/client";

interface BTCInOuts {
address: string;
Expand Down Expand Up @@ -62,13 +63,7 @@ interface SubstrateRawInfo {
asset_type: string;
}

interface KadenaRawInfo {
gas: number;
result: { status: string; data: string };
reqKey: string;
logs: string;
txId: number;
}
type KadenaRawInfo = ICommandResult;

enum ActivityStatus {
pending = "pending",
Expand Down
Loading

0 comments on commit 5a56203

Please sign in to comment.