Skip to content

Commit

Permalink
update claim dust
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonard-Pat committed Jul 1, 2024
1 parent e42c408 commit 10eeca5
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions scripts/claim-dust.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { CallData } from "starknet";
import { calculateEscrowAddress } from "../lib";
import { Gift, buildGiftCallData, executeActionOnAccount } from "../lib/claim";
import { logTransactionJson } from "./jsonTxBuilder";

/// To use this script, fill in the following value:
/// - factoryAddress: the address of the factory contract
/// - escrowAddress: the address of the escrow account
/// - dustReceiver: the address of the dust receiver
/// - claim: the claim object

const factoryAddress = "";
const escrowAddress = "";
const dustReceiver = "";
const claim: Gift = {
factory: factoryAddress,
Expand All @@ -30,19 +29,15 @@ if (!dustReceiver) {
throw new Error("Dust receiver address is not set. Please set it in the script file.");
}

if (!escrowAddress) {
throw new Error("Escrow address is not set. Please set it in the script file.");
}

for (const key in claim) {
if (key in claim && !claim[key as keyof typeof claim] && key !== "fee_amount" && key !== "gift_amount") {
throw new Error(`The property ${key} is empty in the claim object.`);
}
}

const tx = executeActionOnAccount(
"get_dust",
escrowAddress,
"claim_dust",
calculateEscrowAddress(claim),
CallData.compile([(buildGiftCallData(claim), dustReceiver)]),
);
logTransactionJson([tx]);

0 comments on commit 10eeca5

Please sign in to comment.