
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
@arcana/ca-sdk
Advanced tools
Enable unified balance in Web3 apps. Perform chain-abstracted blockchain transactions.
npm install @arcana/ca-sdk
import { CA } from "@arcana/ca-sdk";
const provider = window.ethereum;
const ca = new CA();
ca.setEVMProvider(provider);
await ca.init();
const providerWithCA = ca.getEVMProviderWithCA();
await providerWithCA.request({
method: "eth_sendTransaction",
params: [
{
to: "0xEa46Fb4b4Dc7755BA29D09Ef2a57C67bab383A2f",
from: "0x7f521A827Ce5e93f0C6D773525c0282a21466f8d",
value: "0x001",
},
],
});
// Fuel
await ca.setFuelConnector(connector);
const { provider: mProvider, connector: mConnector } = await ca.getFuelWithCA();
const address = connector.currentAccount()!;
const account = new Account(address, mProvider, mConnector);
await account.transfer(
"0xE78655DfAd552fc3658c01bfb427b9EAb0c628F54e60b54fDA16c95aaAdE797A",
1000000,
"0xa0265fb5c32f6e8db3197af3c7eb05c48ae373605b8165b6f4a51c5b0ba4812e",
);
To integrate, create a CA
object and initialize it. Get the chain abstraction enabled EVM Provider. Use it as a drop in replacement for an EIP-1193 provider (e.g., window.ethereum) in the Web3 app code.
import { CA } from "@arcana/ca-sdk";
const ca = new CA();
ca.setEVMProvider(window.ethereum);
await ca.init();
// For Fuel
await ca.setFuelConnector(connector);
const { provider: mProvider, connector: mConnector } = await ca.getFuelWithCA();
Manage allowance setup and intent processing flows in the Web3 app UI.
setOnAllowanceHook
import type { OnAllowanceHook, OnIntentHook } from "@arcana/ca-sdk";
ca.setOnAllowanceHook(
async ({ allow, deny, sources }: Parameters<OnAllowanceHook>[0]) => {
// This is a hook for the dev to show user the allowances that need to be set up
// for the current tx to happen.
// sources: an array of objects with minAllowance, chainID, token symbol, etc.
// allow(allowances): continues the transaction flow with `allowances` array
// allowances.length === sources.length;
// valid values are "max" | "min" | string | bigint
// deny(): stops the flow
},
);
setOnIntentHook
ca.setOnIntentHook(
({ intent, allow, deny, refresh }: Parameters<OnIntentHook>[0]) => {
// This is a hook for the dev to show user the intent, the sources and associated fees
// intent: Intent data containing sources and fees for display purpose
// allow(): accept the current intent and continue the flow
// deny(): deny the intent and stop the flow
// refresh(): should be on a timer of 5s to refresh the intent
// (old intents might fail due to fee changes if not refreshed)
},
);
Get the list of intents representing user's request for funds. Chain abstracted transactions service these requests.
import type { RFF } from "@arcana/ca-sdk";
const page = 1;
const intentList: RFF[] = await ca.getMyIntents(page);
Get allowance values configured for the chain abstracted transactions. Set to unlimited by default for all supported chains and tokens. Developers can update the allowance settings via setOnAllowanceHook()
.
await ca.allowance().get({
tokens: ["USDC"],
chainID: 137,
});
Get chain abstracted unified balance in the user's EOA.
getUnifiedBalances
Get total balance for all supported tokens across all chains.
const balances = await ca.getUnifiedBalances();
getUnifiedBalance
Get total balance for a specific token across all chains.
const usdtBalance = await ca.getUnifiedBalance("usdt");
Use chain abstracted transactions to transfer funds. Transfer to any chain with a specified token amount. Source funds from the unified balance.
const handler = await ca.transfer({
to: "0x...",
amount: 5,
chainID: 10,
token: "eth",
});
// Execute the transfer
const hash = await handler.exec();
// Simulate the transfer, returns intent data and token info
const response = await handler.simulate();
Use chain abstracted transactions to bridge funds. Bridge to a specified token and chain using unified balance.
const handler = await ca.bridge({
token: "usdt",
amount: 10,
chainID: 137,
});
// Execute the bridge
await handler.exec();
// Simulate the bridge, returns intent data and token info
const response = await handler.simulate();
Handle intent processing events for the chain abstracted transactions.
ca.caEvents.on("expected_steps", (data) => {
state.value.steps = data.map((s) => ({ ...s, done: false }));
});
ca.caEvents.on("step_complete", (data) => {
const v = state.value.steps.find((s) => {
return s.typeID === data.typeID;
});
if (v) {
v.done = true;
}
});
ca.caEvents.removeListener("expected_steps", () => {...})
ca.caEvents.removeListener("step_complete", () => {...})
Refer to the CA SDK Reference Guide for details.
FAQs
Arcana Network's chain abstraction SDK for unified balance in Web3 apps
The npm package @arcana/ca-sdk receives a total of 239 weekly downloads. As such, @arcana/ca-sdk popularity was classified as not popular.
We found that @arcana/ca-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.