@autonomys/auto-utils 0.1.1 → 0.1.3-alpha.0
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/README.md +34 -84
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,106 +1,56 @@
|
|
|
1
|
-
# Autonomys SDK
|
|
1
|
+
# Autonomys Auto SDK Utility
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Overview
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
1. Wallet Management
|
|
8
|
-
2. Network Management
|
|
9
|
-
3. Data Storage
|
|
10
|
-
4. Cryptographic Functions
|
|
11
|
-
5. API Activation
|
|
12
|
-
6. Constants
|
|
13
|
-
7. Types
|
|
5
|
+
The Autonomys Auto SDK Utility provides functionalities for wallet setup, network management, data storage, cryptographic operations, and API activation.
|
|
14
6
|
|
|
15
7
|
## Wallet Management
|
|
16
8
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
```typescript
|
|
22
|
-
export const setupWallet = async (input: MnemonicOrURI): Promise<KeyringPair>
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
- input: The mnemonic or URI used to set up the wallet.
|
|
26
|
-
- Returns a KeyringPair.
|
|
27
|
-
|
|
28
|
-
#### activateWallet
|
|
29
|
-
|
|
30
|
-
Activates a wallet for a given network or domain and returns API and accounts.
|
|
31
|
-
|
|
32
|
-
```typescript
|
|
33
|
-
export const activateWallet = async (input: ActivateWalletInput): Promise<WalletActivated>
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
- input: Network or domain input along with mnemonic or URI and app name.
|
|
37
|
-
- Returns an object containing api and accounts.
|
|
38
|
-
|
|
39
|
-
#### mockWallets
|
|
40
|
-
|
|
41
|
-
Creates mock wallets for a given network or domain.
|
|
42
|
-
|
|
43
|
-
```typescript
|
|
44
|
-
export const mockWallets = async (network: NetworkInput | DomainInput): Promise<WalletActivated[]>
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
- network: Network or domain input.
|
|
48
|
-
- Returns an array of WalletActivated objects.
|
|
49
|
-
|
|
50
|
-
#### getMockWallet
|
|
51
|
-
|
|
52
|
-
Retrieves a mock wallet by name.
|
|
53
|
-
|
|
54
|
-
```typescript
|
|
55
|
-
export const getMockWallet = (name: string, wallets: WalletActivated[]): WalletActivated
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
- name: Name of the mock wallet.
|
|
59
|
-
- wallets: Array of activated wallets.
|
|
60
|
-
- Returns a WalletActivated object.
|
|
9
|
+
- `setupWallet(input: MnemonicOrURI): Promise<KeyringPair>`: Initializes a wallet using a mnemonic or URI.
|
|
10
|
+
- `activateWallet(input: ActivateWalletInput): Promise<WalletActivated>`: Activates a wallet and returns API and accounts.
|
|
11
|
+
- `mockWallets(network: NetworkInput | DomainInput): Promise<WalletActivated[]>`: Creates mock wallets for testing.
|
|
12
|
+
- `getMockWallet(name: string, wallets: WalletActivated[]): WalletActivated`: Retrieves a mock wallet by name.
|
|
61
13
|
|
|
62
|
-
|
|
14
|
+
## Network Management
|
|
63
15
|
|
|
64
|
-
|
|
16
|
+
- `getNetworkDetails(input?: NetworkInput): Network`: Gets network details.
|
|
17
|
+
- `getNetworkRpcUrls(input?: NetworkInput): string[]`: Gets network RPC URLs.
|
|
18
|
+
- `getNetworkDomainDetails(input: DomainInput): Domain`: Gets domain details.
|
|
19
|
+
- `getNetworkDomainRpcUrls(input: DomainInput): string[]`: Gets domain RPC URLs.
|
|
65
20
|
|
|
66
|
-
|
|
21
|
+
## Data Storage
|
|
67
22
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
```
|
|
23
|
+
- `save(key: string, value: any)`: Saves data to local storage or file system.
|
|
24
|
+
- `read(key: string): any`: Reads data from local storage or file system.
|
|
71
25
|
|
|
72
|
-
|
|
73
|
-
- Returns network details.
|
|
26
|
+
## Cryptographic Functions
|
|
74
27
|
|
|
75
|
-
|
|
28
|
+
- `blake2b_256(data: Uint8Array): string`: Hashes data with BLAKE2b-256.
|
|
29
|
+
- `stringToUint8Array(text: string): Uint8Array`: Converts a string to a Uint8Array.
|
|
30
|
+
- `concatenateUint8Arrays(array1: Uint8Array, array2: Uint8Array): Uint8Array`: Concatenates two Uint8Arrays.
|
|
76
31
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
```typescript
|
|
80
|
-
export const getNetworkRpcUrls = (input?: NetworkInput) => string[]
|
|
81
|
-
```
|
|
32
|
+
## API Activation
|
|
82
33
|
|
|
83
|
-
- input:
|
|
84
|
-
-
|
|
34
|
+
- `activate(input?: NetworkInput): Promise<ApiPromise>`: Activates the API for a network.
|
|
35
|
+
- `activateDomain(input: DomainInput): Promise<ApiPromise>`: Activates the API for a domain.
|
|
36
|
+
- `disconnect()`: Disconnects the API.
|
|
37
|
+
- `disconnectDomain()`: Disconnects the domain API.
|
|
85
38
|
|
|
86
|
-
|
|
39
|
+
## Constants
|
|
87
40
|
|
|
88
|
-
|
|
41
|
+
- `networks`: Array of network configurations.
|
|
42
|
+
- `defaultNetwork`: Default network configuration.
|
|
43
|
+
- `mockURIs`: Array of mock URIs.
|
|
89
44
|
|
|
90
|
-
|
|
91
|
-
export const getNetworkDomainDetails = (input: DomainInput) => Domain
|
|
92
|
-
```
|
|
45
|
+
## Types
|
|
93
46
|
|
|
94
|
-
-
|
|
95
|
-
-
|
|
47
|
+
- `Network`, `Domain`, `Explorer`, `NetworkInput`, `DomainInput`
|
|
48
|
+
- `Mnemonic`, `URI`, `AppName`, `MnemonicOrURI`
|
|
96
49
|
|
|
97
|
-
|
|
50
|
+
For more details, refer to the source files in the `src` directory.
|
|
98
51
|
|
|
99
|
-
|
|
52
|
+
## Import Example
|
|
100
53
|
|
|
101
54
|
```typescript
|
|
102
|
-
|
|
55
|
+
import { activateWallet } from '@autonomys/auto-utils'
|
|
103
56
|
```
|
|
104
|
-
|
|
105
|
-
- input: Domain input.
|
|
106
|
-
- Returns an array of RPC URLs.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autonomys/auto-utils",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3-alpha.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"browser": {
|
|
37
37
|
"fs": false
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "438f0fefdd77e291689a8a1233e28bc8792d5503"
|
|
40
40
|
}
|