Skip to content

Commit

Permalink
fix: undo change
Browse files Browse the repository at this point in the history
  • Loading branch information
hcote committed Dec 11, 2024
1 parent 51a6fb5 commit 71442d6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
12 changes: 7 additions & 5 deletions src/pact/transfer-create.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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),
Expand Down
12 changes: 7 additions & 5 deletions src/pact/transfer-crosschain.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand Down Expand Up @@ -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
)
Expand All @@ -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();
Expand Down

0 comments on commit 71442d6

Please sign in to comment.