Abstraction wallet SDK allow developers connect their Dapps to Abstraction Wallet via EIP-6963
# yarn
yarn add @abstraction-hq/wallet-skd
# npm
npm install @abstraction-hq/wallet-sdk
import { initAbstractionWallet } from "@abstraction-hq/wallet-sdk";
initAbstractionWallet();
import { createAbstractionProvider } from "@abstraction-hq/wallet-sdk";
const provider = createAbstractionProvider();
- Connect Wallet
const addresses = provider.request({
method: "eth_requestAccounts",
});
- Send Transaction
const txHash = await(window as any).abstraction.request({
method: "eth_sendTransaction",
params: [
{
from: address,
to: address,
value: 0,
data,
},
],
});
- Sending multiple calls
const userOpHash = await(window as any).abstraction.request({
method: "wallet_sendCalls",
params: [
{
version: "1.0",
chainId: "0x58",
from: "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
calls: [
{
to: "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
value: "0x9184e72a",
data: "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
},
{
to: "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
value: "0x9184e72a",
data: "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
},
]
}
],
});
- Get call status
const callStatus = await(window as any).abstraction.request({
method: "wallet_getCallsStatus",
params: [
userOpHash
],
});
- Create contract
const txHash = await(window as any).abstraction.request({
method: "eth_sendTransaction",
params: [
{
from: address,
value: 0,
data: CONTRACT_BYTECODE,
},
],
salt: // Salt to create contract with create2 - account.nonce() if not provide
});