-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsell-evm.ts
More file actions
33 lines (26 loc) · 1.44 KB
/
sell-evm.ts
File metadata and controls
33 lines (26 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { config } from "dotenv";
import { CHAIN_ID, UniversalAccount } from "@particle-network/universal-account-sdk";
import { getBytes, Wallet } from "ethers";
config();
(async () => {
const wallet = new Wallet(process.env.PRIVATE_KEY || "");
const universalAccount = new UniversalAccount({
projectId: process.env.PROJECT_ID || "",
projectClientKey: process.env.PROJECT_CLIENT_KEY || "",
projectAppUuid: process.env.PROJECT_APP_UUID || "",
ownerAddress: wallet.address,
});
const smartAccountOptions = await universalAccount.getSmartAccountOptions();
console.log('Your UA EVM Address:', smartAccountOptions.smartAccountAddress);
console.log('Your UA Solana Address:', smartAccountOptions.solanaSmartAccountAddress);
const transaction = await universalAccount.createSellTransaction({
token: { chainId: CHAIN_ID.ARBITRUM_MAINNET_ONE, address: "0x912CE59144191C1204E64559FE8253a0e49E6548" },
// sell 0.0001 ARB Token (here ignore the decimals)
// please make sure your UA Address has enough balance of this token
amount: "0.0001",
});
console.log("sell transaction", transaction);
const sendResult = await universalAccount.sendTransaction(transaction, wallet.signMessageSync(getBytes(transaction.rootHash)));
console.log("sendResult", sendResult);
console.log("explorer url", `https://universalx.app/activity/details?id=${sendResult.transactionId}`);
})();