@eva-protocol/sdk 0.0.1-beta.10 → 0.0.1-beta.11
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
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# @eva-protocol/sdk
|
|
2
|
+
|
|
3
|
+
TypeScript SDK for **EVA Protocol** — decentralized insurance on Sui.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @eva-protocol/sdk
|
|
9
|
+
# or
|
|
10
|
+
pnpm add @eva-protocol/sdk
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { EvaClient, getNetworkConfig } from '@eva-protocol/sdk';
|
|
17
|
+
|
|
18
|
+
const client = new EvaClient({
|
|
19
|
+
network: 'testnet',
|
|
20
|
+
config: getNetworkConfig('testnet'),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// Deposit USDE to mint EVA
|
|
24
|
+
const tx = await client.buildDepositTx({ amount: 100n * 10n ** 9n });
|
|
25
|
+
// Sign and execute with your wallet...
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Features
|
|
29
|
+
|
|
30
|
+
- **Capital Pool**: Deposit USDE, redeem EVA
|
|
31
|
+
- **Staking**: Stake EVA to provide underwriting capacity
|
|
32
|
+
- **Cover**: Buy insurance coverage
|
|
33
|
+
- **Claims**: Submit claims, vote, redeem payouts
|
|
34
|
+
- **Seal**: Encrypt evidence for claim assessment
|
|
35
|
+
- **Walrus**: Upload claim evidence
|
|
36
|
+
|
|
37
|
+
## API
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
// Capital Pool
|
|
41
|
+
client.buildDepositTx(params);
|
|
42
|
+
client.buildRedeemTx(params);
|
|
43
|
+
client.buildWithdrawTreasuryTx(params);
|
|
44
|
+
|
|
45
|
+
// Cover
|
|
46
|
+
client.buildBuyCoverTx(params);
|
|
47
|
+
client.getPremiumWithFee(params);
|
|
48
|
+
|
|
49
|
+
// Staking
|
|
50
|
+
client.buildCreateProofTx(params);
|
|
51
|
+
client.buildStakeTx(params);
|
|
52
|
+
client.buildUnstakeTx(params);
|
|
53
|
+
|
|
54
|
+
// Claims
|
|
55
|
+
client.buildSubmitClaimTx(params);
|
|
56
|
+
client.buildCastVoteTx(params);
|
|
57
|
+
client.buildRedeemClaimPayoutTx(params);
|
|
58
|
+
client.buildRetrieveDepositTx(params);
|
|
59
|
+
|
|
60
|
+
// Queries
|
|
61
|
+
client.getPoolInfo();
|
|
62
|
+
client.getProtocolStatus(protocolName);
|
|
63
|
+
client.getClaim(claimId);
|
|
64
|
+
// ... and more
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Requirements
|
|
68
|
+
|
|
69
|
+
- Node.js >= 18
|
|
70
|
+
- Sui wallet (e.g. Sui Wallet, Ethos)
|
|
71
|
+
|
|
72
|
+
## License
|
|
73
|
+
|
|
74
|
+
ISC
|
|
@@ -6,5 +6,5 @@ export type { Network, NetworkConfig } from '../types';
|
|
|
6
6
|
export declare function getNetworkConfig(network: Network): NetworkConfig;
|
|
7
7
|
/** Pre-built testnet config (from setup_scrips/constants). Use for examples and testnet. */
|
|
8
8
|
export declare const TESTNET_CONFIG: NetworkConfig;
|
|
9
|
-
export declare const USDE_TYPE = "
|
|
9
|
+
export declare const USDE_TYPE = "0xc59303f7fe27a127bdfb0d17834e9b976a446408dbd62674b06945f4902ed659::usde::USDE";
|
|
10
10
|
//# sourceMappingURL=networks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"networks.d.ts","sourceRoot":"","sources":["../../../src/config/networks.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"networks.d.ts","sourceRoot":"","sources":["../../../src/config/networks.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AA4EvD,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEvD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,aAAa,CAEhE;AAED,4FAA4F;AAC5F,eAAO,MAAM,cAAc,EAAE,aAA8B,CAAC;AAE5D,eAAO,MAAM,SAAS,mFAAgC,CAAC"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// From setup_scrips/constants.ts
|
|
2
|
-
const PROTOCOL_PACKAGE = '
|
|
3
|
-
const EVA_PACKAGE = '
|
|
4
|
-
const USDE_PACKAGE = '
|
|
5
|
-
const CONFIG = '
|
|
6
|
-
const STAKING_REGISTRY = '
|
|
7
|
-
const CLAIMS_VAULT = '
|
|
8
|
-
const RISK_REGISTRY = '
|
|
9
|
-
const COVER_VAULT = '
|
|
10
|
-
const CAPITAL_POOL = '
|
|
11
|
-
const ALLOWLIST = '
|
|
2
|
+
const PROTOCOL_PACKAGE = '0x6e1cd6b84503dc406c036ddb10dc1a544a35510dbee399b8fb8927cc0bfd1e4c';
|
|
3
|
+
const EVA_PACKAGE = '0xbb3cc8ae6f0722752585995a30f8bb99265667991678458c7f08115bae5049bb';
|
|
4
|
+
const USDE_PACKAGE = '0xc59303f7fe27a127bdfb0d17834e9b976a446408dbd62674b06945f4902ed659';
|
|
5
|
+
const CONFIG = '0x8bedd3d8e9c5d9773a35ca46f062986aa8bd64f23e480c7d3a52356ecdb8c8c7';
|
|
6
|
+
const STAKING_REGISTRY = '0x515cfc95ce02d6f1500a380fa3cf129cb5618d1934d2b224024e01d65f11dbe9';
|
|
7
|
+
const CLAIMS_VAULT = '0x4087bd058b3a28c7da52ca0b8fe55594a5021abee0847dc54a514b4e025f4027';
|
|
8
|
+
const RISK_REGISTRY = '0x11e47af913132dfaf2f6b79b03bfbfb81dbc06882caf076f5656e5ad87eb9a04';
|
|
9
|
+
const COVER_VAULT = '0xd89d5b4c5ac82264ebc993c7f0b09fcdee4a8fdd5c2724ae0e8668ea8492645b';
|
|
10
|
+
const CAPITAL_POOL = '0x03d4f481c609d66a9d65e10369d073f2f1153b27b83e31a932a4b7241e7baa6b';
|
|
11
|
+
const ALLOWLIST = '0xd97c192b19d19f24e0b06203774f9cb8dc05c7b1d444cad33d1a2c4b4af97a3a';
|
|
12
12
|
// USDE faucet - update after running setup_scrips/new_faucet.ts if needed
|
|
13
|
-
const FAUCET_ID = '
|
|
13
|
+
const FAUCET_ID = '';
|
|
14
14
|
const TESTNET = {
|
|
15
15
|
packageIds: {
|
|
16
16
|
protocol: PROTOCOL_PACKAGE,
|
|
@@ -33,7 +33,9 @@ const TESTNET = {
|
|
|
33
33
|
seal: {
|
|
34
34
|
packageId: PROTOCOL_PACKAGE,
|
|
35
35
|
serverConfigs: [
|
|
36
|
-
|
|
36
|
+
{ objectId: '0x73d05d62c18d9374e3ea529e8e0ed6161da1a141a94d3f76ae3fe4e99356db75', weight: 1 },
|
|
37
|
+
{ objectId: '0x6068c0acb197dddbacd4746a9de7f025b2ed5a5b6c1b1ab44dade4426d141da2', weight: 1 },
|
|
38
|
+
{ objectId: '0x5466b7df5c15b508678d51496ada8afab0d6f70a01c10613123382b1b8131007', weight: 1 },
|
|
37
39
|
],
|
|
38
40
|
},
|
|
39
41
|
walrus: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"networks.js","sourceRoot":"","sources":["../../../src/config/networks.ts"],"names":[],"mappings":"AAKA,iCAAiC;AACjC,MAAM,gBAAgB,GAAG,oEAAoE,CAAC;AAC9F,MAAM,WAAW,GAAG,oEAAoE,CAAC;AACzF,MAAM,YAAY,GAAG,oEAAoE,CAAC;AAE1F,MAAM,MAAM,GAAG,oEAAoE,CAAC;AACpF,MAAM,gBAAgB,GAAG,oEAAoE,CAAC;AAC9F,MAAM,YAAY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,EAAE,CAAC;AAE5D,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,YAAY,cAAc,CAAC"}
|
|
@@ -70,7 +70,7 @@ export async function uploadToWalrus(walrusClient, params, signer) {
|
|
|
70
70
|
const storageInfo = await walrusClient.walrus.writeBlob({
|
|
71
71
|
blob: params.blob,
|
|
72
72
|
deletable: params.deletable ?? true,
|
|
73
|
-
epochs: params.epochs ??
|
|
73
|
+
epochs: params.epochs ?? 7,
|
|
74
74
|
signer: signer,
|
|
75
75
|
});
|
|
76
76
|
return { blobId: storageInfo.blobId };
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "@eva-protocol/sdk",
|
|
3
|
-
"
|
|
2
|
+
"name": "@eva-protocol/sdk",
|
|
3
|
+
"version": "0.0.1-beta.11",
|
|
4
|
+
"description": "TypeScript SDK for EVA Protocol - decentralized insurance on Sui",
|
|
4
5
|
"main": "dist/src/index.js",
|
|
5
6
|
"module": "dist/src/index.js",
|
|
6
7
|
"types": "dist/src/index.d.ts",
|
|
@@ -24,12 +25,24 @@
|
|
|
24
25
|
"sui",
|
|
25
26
|
"eva",
|
|
26
27
|
"insurance",
|
|
27
|
-
"protocol"
|
|
28
|
+
"protocol",
|
|
29
|
+
"decentralized"
|
|
28
30
|
],
|
|
29
31
|
"license": "ISC",
|
|
30
32
|
"engines": {
|
|
31
33
|
"node": ">=18"
|
|
32
34
|
},
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "https://github.com/paulwu0903/eva-protocol.git"
|
|
41
|
+
},
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://github.com/paulwu0903/eva-protocol/issues"
|
|
44
|
+
},
|
|
45
|
+
"homepage": "https://github.com/paulwu0903/eva-protocol#readme",
|
|
33
46
|
"dependencies": {
|
|
34
47
|
"@mysten/seal": "^1.0.0",
|
|
35
48
|
"@mysten/sui": "^2.3.1",
|