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 +28 -66
- package/dist/{browser-qqJ1fujK.js → browser-Cw1djZTy.js} +1 -1
- package/dist/{ccip-BBUN2eEu.js → ccip-HHFnB-BQ.js} +1 -1
- package/dist/{index-YvEK7vYp.js → index-C8WXLf_Q.js} +10641 -1627
- package/dist/index.d.ts +1305 -618
- package/dist/salt.es.js +6 -5
- package/package.json +13 -6
package/README.md
CHANGED
|
@@ -1,84 +1,46 @@
|
|
|
1
|
-
# Salt SDK
|
|
1
|
+
# Salt SDK []()
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
|
|
5
|
+
## Documentation
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
### [📃 developer.salt.space/sdk](https://developer.salt.space/sdk/classes/Salt.html)
|
|
8
8
|
|
|
9
|
-
|
|
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
|
-
|
|
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
|
-
|
|
13
|
+
```typescript
|
|
14
|
+
import { Salt, TransferType } from 'salt-sdk';
|
|
15
|
+
import { Wallet } from 'ethers';
|
|
27
16
|
|
|
28
|
-
|
|
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
|
-
|
|
31
|
-
|
|
22
|
+
// Substitute this with a proper signer creation
|
|
23
|
+
const signer = Wallet.createRandom();
|
|
32
24
|
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
// Authenticate with SIWE - https://developer.salt.space/sdk/classes/Salt.html#authenticate
|
|
26
|
+
await salt.authenticate(signer);
|
|
35
27
|
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
44
|
+
See [ARCHITECTURE.md](./ARCHITECTURE.md) for more details.
|
|
83
45
|
|
|
84
|
-
|
|
46
|
+

|
|
@@ -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-
|
|
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.", {
|