1.2.12 • Published 2 years ago
@nekoproject/wallets v1.2.12
@nekoproject/wallets
A complete crypto wallet base support for cross-chain
Table of contents
Build
Re-build project from scratch
- Clean project
npm run clean
- Build
npm run build
- Unit test
```bash npm run test:cover ```
Install
Install@nekoproject/wallets
withnpm
Importnpm i @nekoproject/wallets
import { Wallet, SPLWallet } from '@nekoproject/wallets'
Documents
Solana Keypair defined in@nekoproject/wallets
interface SolanaKeypair {
publicKey: web3.PublicKey;
secretKey: Uint8Array;
}
Wallet methods
Load or Create wallet
- Generate new wallet
let wallet: Wallet; // generate new solana wallet wallet = SPLWallet.generateWallet()
- Load wallet from seed pharse
let wallet: Wallet; // load solana wallet const mnemonic = 'seeds pharse' wallet = SPLWallet.fromMnemonic(mnemonic)
- Load wallet from secret Key
import fs from 'mz/fs'; const filePath = path/to/json/secretKey/file const secretKeyString = await fs.readFile(filePath, { encoding: 'utf8' }); const secretKey = Uint8Array.from(JSON.parse(secretKeyString)); let wallet: Wallet; // load solana wallet wallet = SPLWallet.fromSecretKey(secretKey)
- Load wallet from string secret Key
```ts const secretStringKey = '2PU5z5WF9oteEcMfrKswairtm4H69XakqPFNRVBoadw4uTFEPDtUWzp6YirXtVSuybJ2kYVchCPxKisbdTRurcMM' let wallet: Wallet; // load solana wallet wallet = SPLWallet.fromStringSecretKey(secretStringKey) ```
Getter
- Signer
const signer: SolanaKeypair = wallet.signer
- Address
const publicKey = wallet.address
Notice
Ref
1.2.12
2 years ago
1.2.8
2 years ago
1.2.7
2 years ago
1.2.6
2 years ago
1.2.5
2 years ago
1.2.4
2 years ago
1.2.9
2 years ago
1.2.10
2 years ago
1.2.11
2 years ago
1.2.3
2 years ago
1.1.0
2 years ago
1.0.9
2 years ago
1.0.8
2 years ago
1.2.2
2 years ago
1.1.2
2 years ago
1.0.7
2 years ago
1.0.6
2 years ago
1.0.5
2 years ago
1.0.4
2 years ago
1.0.3
2 years ago
1.0.2
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago