zoa-wallet 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +28 -5
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -47983,13 +47983,32 @@ var SolanaAdapter = class {
|
|
|
47983
47983
|
async signAndSendNativeTransfer(params) {
|
|
47984
47984
|
const secretBytes = Uint8Array.from((params.privateKey.startsWith("0x") ? params.privateKey.slice(2) : params.privateKey).match(/.{1,2}/g).map((byte) => Number.parseInt(byte, 16)));
|
|
47985
47985
|
const keypair = Keypair.fromSecretKey(secretBytes);
|
|
47986
|
+
const balance = await this.connection.getBalance(keypair.publicKey);
|
|
47987
|
+
const lamports = Number(params.value);
|
|
47988
|
+
const estimatedFee = 5e3;
|
|
47989
|
+
if (balance < lamports + estimatedFee) {
|
|
47990
|
+
const balSOL = (balance / LAMPORTS_PER_SOL).toFixed(6);
|
|
47991
|
+
const needed = ((lamports + estimatedFee) / LAMPORTS_PER_SOL).toFixed(6);
|
|
47992
|
+
throw new Error(`Insufficient SOL balance. You have ${balSOL} SOL but need ${needed} SOL (${(lamports / LAMPORTS_PER_SOL).toFixed(6)} SOL + ~0.000005 SOL tx fee).`);
|
|
47993
|
+
}
|
|
47986
47994
|
const transaction = new Transaction().add(SystemProgram.transfer({
|
|
47987
47995
|
fromPubkey: keypair.publicKey,
|
|
47988
47996
|
toPubkey: new PublicKey(params.to),
|
|
47989
|
-
lamports
|
|
47997
|
+
lamports
|
|
47990
47998
|
}));
|
|
47991
|
-
|
|
47992
|
-
|
|
47999
|
+
try {
|
|
48000
|
+
const signature = await sendAndConfirmTransaction(this.connection, transaction, [keypair], { commitment: "confirmed" });
|
|
48001
|
+
return { hash: signature };
|
|
48002
|
+
} catch (error) {
|
|
48003
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
48004
|
+
if (msg.includes("Simulation failed")) {
|
|
48005
|
+
throw new Error(`Transaction simulation failed. This usually means insufficient balance to cover the transfer amount plus network fees (~0.000005 SOL).`);
|
|
48006
|
+
}
|
|
48007
|
+
if (msg.includes("blockhash")) {
|
|
48008
|
+
throw new Error("Transaction expired. The network may be congested \u2014 please try again.");
|
|
48009
|
+
}
|
|
48010
|
+
throw error;
|
|
48011
|
+
}
|
|
47993
48012
|
}
|
|
47994
48013
|
async getTransactionReceipt(_hash) {
|
|
47995
48014
|
return null;
|
|
@@ -49959,6 +49978,10 @@ function registerSendCommand(program2) {
|
|
|
49959
49978
|
} else {
|
|
49960
49979
|
lines.push(kvLine("Service Fee", colors.success("FREE")));
|
|
49961
49980
|
}
|
|
49981
|
+
if (isNativeTransfer && value === selectedToken.balance) {
|
|
49982
|
+
lines.push("");
|
|
49983
|
+
lines.push(colors.warning(" \u26A0 Sending entire balance \u2014 some will be reserved for gas fees."));
|
|
49984
|
+
}
|
|
49962
49985
|
console.log();
|
|
49963
49986
|
console.log(infoBox("Transaction Details", lines));
|
|
49964
49987
|
console.log();
|
|
@@ -50554,7 +50577,7 @@ var zoaGradient2 = gradient2([
|
|
|
50554
50577
|
"#c77dff"
|
|
50555
50578
|
]);
|
|
50556
50579
|
var subtleGradient = gradient2(["#6b7280", "#9ca3af", "#6b7280"]);
|
|
50557
|
-
var VERSION = "0.3.
|
|
50580
|
+
var VERSION = "0.3.3";
|
|
50558
50581
|
async function displayBanner() {
|
|
50559
50582
|
const banner = figlet.textSync("ZOA-wallet", { font: "ANSI Shadow" });
|
|
50560
50583
|
console.log();
|
|
@@ -50592,7 +50615,7 @@ program.hook("preAction", async (_thisCommand, actionCommand) => {
|
|
|
50592
50615
|
}
|
|
50593
50616
|
}
|
|
50594
50617
|
});
|
|
50595
|
-
program.name("zoa").description("ZOA Wallet \u2014 API-First Crypto Wallet for Power-traders, Developers, & AI Agents").version("0.3.
|
|
50618
|
+
program.name("zoa").description("ZOA Wallet \u2014 API-First Crypto Wallet for Power-traders, Developers, & AI Agents").version("0.3.3");
|
|
50596
50619
|
registerWalletCommand(program);
|
|
50597
50620
|
registerBalanceCommand(program);
|
|
50598
50621
|
registerSendCommand(program);
|
package/package.json
CHANGED