Skip to content

Commit

Permalink
simplify getTransactionStatus
Browse files Browse the repository at this point in the history
  • Loading branch information
Takadenoshi committed Jan 22, 2024
1 parent 5a56203 commit 4c1516f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions packages/extension/src/providers/kadena/libs/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ProviderAPIInterface } from "@/types/provider";
import { KadenaNetworkOptions } from "../types/kadena-network";
import {
ICommand,
IUnsignedCommand,
ICommandResult,
ITransactionDescriptor,
createClient,
Expand Down Expand Up @@ -90,17 +91,13 @@ class API implements ProviderAPIInterface {
}

async getBalanceAPI(account: string, chainId: string) {
const { dirtyRead } = createClient(this.getApiHost(chainId));

const transaction = Pact.builder
.execution(Pact.modules.coin["get-balance"](account))
.setMeta({ chainId: chainId as ChainId })
.setNetworkId(this.networkId)
.createTransaction();

const res = await dirtyRead(transaction);

return res;
return this.dirtyRead(transaction);
}

async sendLocalTransaction(
Expand All @@ -127,7 +124,9 @@ class API implements ProviderAPIInterface {
return client.listen(transactionDescriptor);
}

async dirtyRead(signedTranscation: ICommand): Promise<ICommandResult> {
async dirtyRead(
signedTranscation: ICommand | IUnsignedCommand
): Promise<ICommandResult> {
const chainId = await this.getChainId();
const client = createClient(this.getApiHost(chainId));
return client.dirtyRead(signedTranscation);
Expand Down

0 comments on commit 4c1516f

Please sign in to comment.