diff --git a/src/pact/transfer-create.ts b/src/pact/transfer-create.ts index 1aa9e53..7ed71bc 100644 --- a/src/pact/transfer-create.ts +++ b/src/pact/transfer-create.ts @@ -1,5 +1,5 @@ import { ChainId, IPactDecimal } from "@kadena/types"; -import { Pact, ISigner, literal, readKeyset } from "@kadena/client"; +import { Pact, ISigner, literal } from "@kadena/client"; import { NETWORK_ID } from "../utils/constants"; interface TransferCreateTransaction { @@ -29,18 +29,20 @@ export const buildTransferCreateTransaction = ({ } : senderPubKey; - const guard = isSpireKeyAccount ? literal(`(keyset-ref-guard "${to.substring(2)}")`) : readKeyset("receiverKeyset"); - return Pact.builder .execution( (Pact.modules as any).coin["transfer-create"]( from, to, - guard, + literal( + `(at 'guard (coin.details + "${to}" + ))` + ), amount ) ) - .addKeyset("receiverKeyset", "keys-all", receiverPubKey) + .addKeyset("receiver-guard", "keys-all", receiverPubKey) .addSigner(signer, (withCapability: any) => [ withCapability("coin.GAS"), withCapability("coin.TRANSFER", from, to, amount), diff --git a/src/pact/transfer-crosschain.ts b/src/pact/transfer-crosschain.ts index 530cdf9..5365c6e 100644 --- a/src/pact/transfer-crosschain.ts +++ b/src/pact/transfer-crosschain.ts @@ -1,4 +1,4 @@ -import { ChainId, Pact, ISigner, literal, readKeyset } from "@kadena/client"; +import { ChainId, Pact, ISigner, literal } from "@kadena/client"; import { NETWORK_ID } from "../utils/constants"; import { IPactDecimal } from "@kadena/types"; @@ -31,14 +31,16 @@ export const buildTransferCrosschainTransaction = ({ } : senderPubKey; - const guard = isSpireKeyAccount ? literal(`(keyset-ref-guard "${to.substring(2)}")`) : readKeyset("receiverKeyset"); - return Pact.builder .execution( (Pact.modules as any).coin.defpact["transfer-crosschain"]( from, to, - guard, + literal( + `(at 'guard (coin.details + "${to}" + ))` + ), toChainId, amount ) @@ -47,7 +49,7 @@ export const buildTransferCrosschainTransaction = ({ signFor("coin.GAS"), signFor("coin.TRANSFER_XCHAIN", from, to, amount, toChainId), ]) - .addKeyset("receiverKeyset", "keys-all", receiverPubKey) + .addKeyset("receiver-guard", "keys-all", receiverPubKey) .setMeta({ chainId: fromChainId, senderAccount: from }) .setNetworkId(NETWORK_ID) .createTransaction();