0.0.2 • Published 2 years ago
p2p-jssdk v0.0.2
P2P Web js-sdk
DEV 开发
yarn add git+ssh://git@github.com:P2P-Bazaar/p2p-jssdk.git#<commmit id>
yarn add git+ssh://git@github.com:P2P-Bazaar/p2p-jssdk.git#<tag>
基础使用
import {WalletConnect, apiService} from "p2p-jssdk";
连接钱包
// walletconnect
await WalletConnect.connect("walletconnect", async (connectInfo) => {
if (connectInfo.status) {
// connect success
}
})
// metamask
await WalletConnect.connect("metamask", async (connectInfo) => {
if (connectInfo.status) {
// connect success
}
})
// node 使用私钥
let privateKey = "0xfa634cc9e287099dd22cc0604474aad2b3e3ec25e1f1148be7df8927a6966d14"
let rpcUrl = "https://rinkeby.arbitrum.io/rpc"
let chainId = 421611
const provider = new PrivateKeyProvider(privateKey, rpcUrl, chainId);
await WalletConnect.connect(provider, async (connectInfo) => {
if (connectInfo.status) {
// connect success
}
})