salt-sdk 0.0.8 → 0.0.10

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 CHANGED
@@ -1,84 +1,46 @@
1
- # Salt SDK
1
+ # Salt SDK [![NPM Version](https://img.shields.io/npm/v/salt-sdk)]()
2
2
 
3
- ## Prerequesites
3
+ TypeScript client for [Salt](https://salt.space), an open MPC self-custodial infrastructure for organisations. With Salt, anyone can spin up a system of self-sovereignty for self-custodial wealth management, including delegations to 3rd parties such as asset managers, robo-advisors or agents.
4
4
 
5
- We currently do not support account creation via the sdk. In order to use the sdk please visit https://testnet.salt.space. Once you're on Salt please create or join an Organisation and create an account.
5
+ ## Documentation
6
6
 
7
- ## Usage
7
+ ### [📃 developer.salt.space/sdk](https://developer.salt.space/sdk/classes/Salt.html)
8
8
 
9
- ```typescript
10
- import { Salt } from 'salt-sdk';
11
- import { ethers } from 'ethers';
9
+ You will need an existing Salt organisation to make use of the SDK. Visit [https://testnet.salt.space](https://testnet.salt.space) to set up a test account.
12
10
 
13
- // ARBITRUM SEPOLIA RPC in TESTNET or ARBITRUM ONE RPC in mainnet
14
- const orchestration_network_provider =
15
- new ethers.providers.StaticJsonRpcProvider({
16
- url: '',
17
- skipFetchSetup: true,
18
- });
19
- // EVM NETWORK RPC WHERE YOU WISH TO BROADCAST
20
- const broadcasting_network_provider =
21
- new ethers.providers.StaticJsonRpcProvider({
22
- url: '',
23
- skipFetchSetup: true,
24
- });
11
+ ## Example
25
12
 
26
- const wallet = new ethers.Wallet('');
13
+ ```typescript
14
+ import { Salt, TransferType } from 'salt-sdk';
15
+ import { Wallet } from 'ethers';
27
16
 
28
- const signer = wallet.connect(orchestration_network_provider);
17
+ // Create an instance of Salt SDK - https://developer.salt.space/sdk/classes/Salt.html#constructor
18
+ const salt = new Salt({
19
+ environment: 'TESTNET',
20
+ });
29
21
 
30
- const sdk = new Salt({ environment: 'TESTNET' });
31
- await sdk.authenticate(signer);
22
+ // Substitute this with a proper signer creation
23
+ const signer = Wallet.createRandom();
32
24
 
33
- const orgs = await sdk.getOrganisations();
34
- const accounts = await sdk.getAccounts(orgs[0]._id);
25
+ // Authenticate with SIWE - https://developer.salt.space/sdk/classes/Salt.html#authenticate
26
+ await salt.authenticate(signer);
35
27
 
36
- const transactionObj = await sdk.transfer({
37
- accountId: accounts[0].id,
38
- to: '0xaD94c511350Cced6DcffCcC34D36558Db86a42A8',
39
- value: '0.0001',
40
- chainId: broadcasting_network_provider.network.chainId,
41
- decimals: 18,
28
+ // Transfer funds - https://developer.salt.space/sdk/classes/Salt.html#transfer
29
+ await salt.transfer({
42
30
  type: TransferType.Native,
31
+ accountId: '0123456', // Salt account ID - https://developer.salt.space/classes/Salt.html#getAccounts
32
+ to: '0x000000000000000000000000000000000000dEaD',
33
+ value: '1',
34
+ decimals: 18,
35
+ chainId: 1,
43
36
  signer: signer,
44
- sendingProvider: broadcasting_network_provider,
45
37
  });
46
-
47
- //subscribe to state transition events
48
-
49
- transactionObj.onPropose((data) => console.log(data));
50
- transactionObj.onSign((data) => console.log(data));
51
- transactionObj.onCombine((data) => console.log(data));
52
- transactionObj.onBroadcast((data) => console.log(data));
53
- transactionObj.onEnd((data) => console.log(data));
54
- transactionObj.onTransition(4, 5, (data) =>
55
- console.log('BROADCAST->END:', data)
56
- );
57
38
  ```
58
39
 
59
- ## Transfer State Machine
40
+ Examples and a full list of available functionality are available at **[https://developer.salt.space/sdk](https://developer.salt.space/sdk/index.html)**.
60
41
 
61
- ```mermaid
62
- stateDiagram-v2
63
- [*] --> IDLE[0]
64
-
65
- IDLE[0] --> PROPOSE[1] : Start Transfer
66
- IDLE[0] --> END[5] : Error Starting Transfer
67
-
68
- PROPOSE[1] --> SIGN[2] : Proposal Created
69
- PROPOSE[1] --> END[5] : Policy Breach
70
-
71
- SIGN[2] --> COMBINE[3] : collected_signatures >= signature_threshold
72
- SIGN[2] --> END[5] : Error Signing
73
-
74
- COMBINE[3] --> BROADCAST[4] : Signatures Combined
75
- COMBINE[3] --> END[5] : Error Combining
76
-
77
- BROADCAST[4] --> END[5] : Transaction Broadcasted
78
-
79
- END[5] --> [*]
80
- ```
42
+ # Development
81
43
 
82
- ## Notes
44
+ See [ARCHITECTURE.md](./ARCHITECTURE.md) for more details.
83
45
 
84
- As of now the SDK is only available to use on TESTNETS via our testnet environment https://testnet.salt.space.
46
+ ![NPM Type Definitions](https://img.shields.io/npm/types/salt-sdk)
@@ -1,4 +1,4 @@
1
- import { g as getDefaultExportFromCjs } from "./index-YvEK7vYp.js";
1
+ import { g as getDefaultExportFromCjs } from "./index-C8WXLf_Q.js";
2
2
  function _mergeNamespaces(n, m) {
3
3
  for (var i = 0; i < m.length; i++) {
4
4
  const e = m[i];
@@ -1,4 +1,4 @@
1
- import { B as BaseError, a as getUrl, s as stringify, d as decodeErrorResult, i as isAddressEqual, l as localBatchGatewayUrl, b as localBatchGatewayRequest, c as call, e as concat, f as encodeAbiParameters, H as HttpRequestError, h as isHex } from "./index-YvEK7vYp.js";
1
+ import { B as BaseError, a as getUrl, s as stringify, d as decodeErrorResult, i as isAddressEqual, l as localBatchGatewayUrl, b as localBatchGatewayRequest, c as call, e as concat, f as encodeAbiParameters, H as HttpRequestError, h as isHex } from "./index-C8WXLf_Q.js";
2
2
  class OffchainLookupError extends BaseError {
3
3
  constructor({ callbackSelector, cause, data, extraData, sender, urls }) {
4
4
  super(cause.shortMessage || "An error occurred while fetching for an offchain result.", {