@opendatalabs/vana-sdk 2.2.1 → 2.2.3-canary.046cb7e
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/dist/config/features.cjs +1 -24
- package/dist/config/features.cjs.map +1 -1
- package/dist/config/features.d.ts +13 -44
- package/dist/config/features.js +1 -24
- package/dist/config/features.js.map +1 -1
- package/dist/controllers/permissions.cjs +19 -14
- package/dist/controllers/permissions.cjs.map +1 -1
- package/dist/controllers/permissions.js +19 -14
- package/dist/controllers/permissions.js.map +1 -1
- package/dist/controllers/staking.cjs +539 -0
- package/dist/controllers/staking.cjs.map +1 -0
- package/dist/controllers/staking.d.ts +404 -0
- package/dist/controllers/staking.js +515 -0
- package/dist/controllers/staking.js.map +1 -0
- package/dist/core.cjs +4 -0
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.ts +3 -0
- package/dist/core.js +4 -0
- package/dist/core.js.map +1 -1
- package/dist/crypto/ecies/index.cjs.map +1 -1
- package/dist/crypto/ecies/index.d.ts +10 -2
- package/dist/crypto/ecies/index.js.map +1 -1
- package/dist/generated/abi/VanaPoolEntityImplementation.cjs +37 -0
- package/dist/generated/abi/VanaPoolEntityImplementation.cjs.map +1 -1
- package/dist/generated/abi/VanaPoolEntityImplementation.d.ts +29 -0
- package/dist/generated/abi/VanaPoolEntityImplementation.js +37 -0
- package/dist/generated/abi/VanaPoolEntityImplementation.js.map +1 -1
- package/dist/generated/abi/VanaPoolStakingImplementation.cjs +156 -19
- package/dist/generated/abi/VanaPoolStakingImplementation.cjs.map +1 -1
- package/dist/generated/abi/VanaPoolStakingImplementation.d.ts +120 -14
- package/dist/generated/abi/VanaPoolStakingImplementation.js +156 -19
- package/dist/generated/abi/VanaPoolStakingImplementation.js.map +1 -1
- package/dist/generated/abi/index.d.ts +149 -14
- package/dist/generated/event-types.cjs.map +1 -1
- package/dist/generated/event-types.d.ts +4 -0
- package/dist/generated/eventRegistry.cjs +24 -0
- package/dist/generated/eventRegistry.cjs.map +1 -1
- package/dist/generated/eventRegistry.js +24 -0
- package/dist/generated/eventRegistry.js.map +1 -1
- package/dist/index.browser.d.ts +4 -0
- package/dist/index.browser.js +12 -0
- package/dist/index.browser.js.map +1 -1
- package/dist/index.node.cjs +15 -0
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.d.ts +5 -0
- package/dist/index.node.js +14 -0
- package/dist/index.node.js.map +1 -1
- package/dist/platform/browser.cjs +40 -119
- package/dist/platform/browser.cjs.map +1 -1
- package/dist/platform/browser.d.ts +7 -7
- package/dist/platform/browser.js +40 -119
- package/dist/platform/browser.js.map +1 -1
- package/dist/platform/node.cjs +51 -129
- package/dist/platform/node.cjs.map +1 -1
- package/dist/platform/node.d.ts +5 -5
- package/dist/platform/node.js +51 -129
- package/dist/platform/node.js.map +1 -1
- package/dist/tests/staking.test.d.ts +1 -0
- package/dist/types/permissions.cjs.map +1 -1
- package/dist/types/permissions.d.ts +2 -0
- package/package.json +1 -2
- package/dist/types/eccrypto-js.d.cjs +0 -2
- package/dist/types/eccrypto-js.d.cjs.map +0 -1
- package/dist/types/eccrypto-js.d.js +0 -1
- package/dist/types/eccrypto-js.d.js.map +0 -1
package/dist/config/features.cjs
CHANGED
|
@@ -21,30 +21,7 @@ __export(features_exports, {
|
|
|
21
21
|
features: () => features
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(features_exports);
|
|
24
|
-
const features = {
|
|
25
|
-
/**
|
|
26
|
-
* Use custom ECIES implementation instead of eccrypto
|
|
27
|
-
*
|
|
28
|
-
* When false (default): Uses the original eccrypto/eccrypto-js libraries for stability
|
|
29
|
-
* When true: Uses the custom platform-specific ECIES implementation
|
|
30
|
-
*
|
|
31
|
-
* Enable by setting environment variable: VANA_USE_CUSTOM_ECIES=true
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* ```bash
|
|
35
|
-
* # Use eccrypto-js (default)
|
|
36
|
-
* VANA_USE_CUSTOM_ECIES=false npm run your-app
|
|
37
|
-
*
|
|
38
|
-
* # Use custom ECIES implementation
|
|
39
|
-
* VANA_USE_CUSTOM_ECIES=true npm run your-app
|
|
40
|
-
* ```
|
|
41
|
-
*
|
|
42
|
-
* @returns Whether to use custom ECIES implementation
|
|
43
|
-
*/
|
|
44
|
-
get useCustomECIES() {
|
|
45
|
-
return process.env.VANA_USE_CUSTOM_ECIES === "true";
|
|
46
|
-
}
|
|
47
|
-
};
|
|
24
|
+
const features = {};
|
|
48
25
|
// Annotate the CommonJS export names for ESM import in node:
|
|
49
26
|
0 && (module.exports = {
|
|
50
27
|
features
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/config/features.ts"],"sourcesContent":["/**\n * Feature flags for the Vana SDK\n *\n * @remarks\n * This module controls feature toggles that allow switching between different\n * implementations or enabling experimental features.\n *\n * The getter pattern is used to allow dynamic evaluation of environment variables,\n * which is necessary for tests to override the default before modules are loaded.\n *\n * ##
|
|
1
|
+
{"version":3,"sources":["../../src/config/features.ts"],"sourcesContent":["/**\n * Feature flags for the Vana SDK\n *\n * @remarks\n * This module controls feature toggles that allow switching between different\n * implementations or enabling experimental features.\n *\n * The getter pattern is used to allow dynamic evaluation of environment variables,\n * which is necessary for tests to override the default before modules are loaded.\n *\n * ## ECIES Encryption\n *\n * The SDK uses a custom ECIES implementation:\n * - **Node.js**: Uses native `secp256k1` module for optimal performance\n * - **Browser**: Uses `@noble/secp256k1` (pure JavaScript)\n * - Fully compatible with eccrypto format for backward compatibility\n *\n * ### Architecture Notes\n * - Browser builds: Use `@noble/secp256k1` (no native dependencies)\n * - Node builds: Use native `secp256k1` when available for better performance\n * - `secp256k1`: Remains an `optionalDependency` so browser-only users don't face build issues\n * - All encrypted data is compatible with the eccrypto format specification\n */\n\n/**\n * Feature flag configuration\n *\n * @remarks\n * Currently empty as all feature flags have been graduated to default behavior.\n * This module is kept for future feature flag additions.\n */\nexport const features = {};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA+BO,MAAM,WAAW,CAAC;","names":[]}
|
|
@@ -8,55 +8,24 @@
|
|
|
8
8
|
* The getter pattern is used to allow dynamic evaluation of environment variables,
|
|
9
9
|
* which is necessary for tests to override the default before modules are loaded.
|
|
10
10
|
*
|
|
11
|
-
* ##
|
|
11
|
+
* ## ECIES Encryption
|
|
12
12
|
*
|
|
13
|
-
* The SDK
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* - Works everywhere (Node.js and browsers)
|
|
18
|
-
* - No native dependencies
|
|
19
|
-
* - Good performance for most use cases
|
|
20
|
-
*
|
|
21
|
-
* 2. **Custom ECIES** (Opt-in)
|
|
22
|
-
* - Uses native `secp256k1` module in Node.js for optimal performance
|
|
23
|
-
* - Uses `@noble/secp256k1` in browsers (pure JS)
|
|
24
|
-
* - Slightly faster in Node.js environments
|
|
25
|
-
* - Currently used by tests to ensure compatibility
|
|
13
|
+
* The SDK uses a custom ECIES implementation:
|
|
14
|
+
* - **Node.js**: Uses native `secp256k1` module for optimal performance
|
|
15
|
+
* - **Browser**: Uses `@noble/secp256k1` (pure JavaScript)
|
|
16
|
+
* - Fully compatible with eccrypto format for backward compatibility
|
|
26
17
|
*
|
|
27
18
|
* ### Architecture Notes
|
|
28
|
-
* - Browser builds:
|
|
29
|
-
* - Node builds:
|
|
19
|
+
* - Browser builds: Use `@noble/secp256k1` (no native dependencies)
|
|
20
|
+
* - Node builds: Use native `secp256k1` when available for better performance
|
|
30
21
|
* - `secp256k1`: Remains an `optionalDependency` so browser-only users don't face build issues
|
|
31
|
-
*
|
|
32
|
-
* ### Future Plans
|
|
33
|
-
* Once the custom ECIES implementation is battle-tested:
|
|
34
|
-
* 1. Make custom ECIES the default
|
|
35
|
-
* 2. Eventually remove eccrypto-js dependency
|
|
36
|
-
* 3. Keep the same architecture (native for Node, @noble for browser)
|
|
22
|
+
* - All encrypted data is compatible with the eccrypto format specification
|
|
37
23
|
*/
|
|
38
24
|
/**
|
|
39
25
|
* Feature flag configuration
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* Currently empty as all feature flags have been graduated to default behavior.
|
|
29
|
+
* This module is kept for future feature flag additions.
|
|
40
30
|
*/
|
|
41
|
-
export declare const features: {
|
|
42
|
-
/**
|
|
43
|
-
* Use custom ECIES implementation instead of eccrypto
|
|
44
|
-
*
|
|
45
|
-
* When false (default): Uses the original eccrypto/eccrypto-js libraries for stability
|
|
46
|
-
* When true: Uses the custom platform-specific ECIES implementation
|
|
47
|
-
*
|
|
48
|
-
* Enable by setting environment variable: VANA_USE_CUSTOM_ECIES=true
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* ```bash
|
|
52
|
-
* # Use eccrypto-js (default)
|
|
53
|
-
* VANA_USE_CUSTOM_ECIES=false npm run your-app
|
|
54
|
-
*
|
|
55
|
-
* # Use custom ECIES implementation
|
|
56
|
-
* VANA_USE_CUSTOM_ECIES=true npm run your-app
|
|
57
|
-
* ```
|
|
58
|
-
*
|
|
59
|
-
* @returns Whether to use custom ECIES implementation
|
|
60
|
-
*/
|
|
61
|
-
readonly useCustomECIES: boolean;
|
|
62
|
-
};
|
|
31
|
+
export declare const features: {};
|
package/dist/config/features.js
CHANGED
|
@@ -1,27 +1,4 @@
|
|
|
1
|
-
const features = {
|
|
2
|
-
/**
|
|
3
|
-
* Use custom ECIES implementation instead of eccrypto
|
|
4
|
-
*
|
|
5
|
-
* When false (default): Uses the original eccrypto/eccrypto-js libraries for stability
|
|
6
|
-
* When true: Uses the custom platform-specific ECIES implementation
|
|
7
|
-
*
|
|
8
|
-
* Enable by setting environment variable: VANA_USE_CUSTOM_ECIES=true
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```bash
|
|
12
|
-
* # Use eccrypto-js (default)
|
|
13
|
-
* VANA_USE_CUSTOM_ECIES=false npm run your-app
|
|
14
|
-
*
|
|
15
|
-
* # Use custom ECIES implementation
|
|
16
|
-
* VANA_USE_CUSTOM_ECIES=true npm run your-app
|
|
17
|
-
* ```
|
|
18
|
-
*
|
|
19
|
-
* @returns Whether to use custom ECIES implementation
|
|
20
|
-
*/
|
|
21
|
-
get useCustomECIES() {
|
|
22
|
-
return process.env.VANA_USE_CUSTOM_ECIES === "true";
|
|
23
|
-
}
|
|
24
|
-
};
|
|
1
|
+
const features = {};
|
|
25
2
|
export {
|
|
26
3
|
features
|
|
27
4
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/config/features.ts"],"sourcesContent":["/**\n * Feature flags for the Vana SDK\n *\n * @remarks\n * This module controls feature toggles that allow switching between different\n * implementations or enabling experimental features.\n *\n * The getter pattern is used to allow dynamic evaluation of environment variables,\n * which is necessary for tests to override the default before modules are loaded.\n *\n * ##
|
|
1
|
+
{"version":3,"sources":["../../src/config/features.ts"],"sourcesContent":["/**\n * Feature flags for the Vana SDK\n *\n * @remarks\n * This module controls feature toggles that allow switching between different\n * implementations or enabling experimental features.\n *\n * The getter pattern is used to allow dynamic evaluation of environment variables,\n * which is necessary for tests to override the default before modules are loaded.\n *\n * ## ECIES Encryption\n *\n * The SDK uses a custom ECIES implementation:\n * - **Node.js**: Uses native `secp256k1` module for optimal performance\n * - **Browser**: Uses `@noble/secp256k1` (pure JavaScript)\n * - Fully compatible with eccrypto format for backward compatibility\n *\n * ### Architecture Notes\n * - Browser builds: Use `@noble/secp256k1` (no native dependencies)\n * - Node builds: Use native `secp256k1` when available for better performance\n * - `secp256k1`: Remains an `optionalDependency` so browser-only users don't face build issues\n * - All encrypted data is compatible with the eccrypto format specification\n */\n\n/**\n * Feature flag configuration\n *\n * @remarks\n * Currently empty as all feature flags have been graduated to default behavior.\n * This module is kept for future feature flag additions.\n */\nexport const features = {};\n"],"mappings":"AA+BO,MAAM,WAAW,CAAC;","names":[]}
|
|
@@ -43,6 +43,7 @@ var import_signatureCache = require("../utils/signatureCache");
|
|
|
43
43
|
var import_signatureFormatter = require("../utils/signatureFormatter");
|
|
44
44
|
var import_typedDataConverter = require("../utils/typedDataConverter");
|
|
45
45
|
var import_base = require("./base");
|
|
46
|
+
const MAX_UINT256 = 115792089237316195423570985008687907853269984665640564039457584007913129639935n;
|
|
46
47
|
class PermissionsController extends import_base.BaseController {
|
|
47
48
|
constructor(context) {
|
|
48
49
|
super(context);
|
|
@@ -1499,20 +1500,24 @@ class PermissionsController extends import_base.BaseController {
|
|
|
1499
1500
|
}
|
|
1500
1501
|
}
|
|
1501
1502
|
const onChainGrants = allPermissions.map(
|
|
1502
|
-
(permission) =>
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1503
|
+
(permission) => {
|
|
1504
|
+
const endBlock = permission.endBlock === void 0 || permission.endBlock === null ? 0n : BigInt(permission.endBlock);
|
|
1505
|
+
const active = !permission.endBlock || endBlock === 0n || endBlock === MAX_UINT256;
|
|
1506
|
+
return {
|
|
1507
|
+
id: BigInt(permission.id),
|
|
1508
|
+
grantUrl: permission.grant,
|
|
1509
|
+
grantSignature: permission.signature,
|
|
1510
|
+
nonce: BigInt(permission.nonce),
|
|
1511
|
+
startBlock: BigInt(permission.startBlock),
|
|
1512
|
+
endBlock,
|
|
1513
|
+
addedAtBlock: BigInt(permission.addedAtBlock),
|
|
1514
|
+
addedAtTimestamp: BigInt(permission.addedAtTimestamp ?? "0"),
|
|
1515
|
+
transactionHash: permission.transactionHash ?? "",
|
|
1516
|
+
grantor: userAddress,
|
|
1517
|
+
grantee: permission.grantee,
|
|
1518
|
+
active
|
|
1519
|
+
};
|
|
1520
|
+
}
|
|
1516
1521
|
);
|
|
1517
1522
|
return onChainGrants.sort((a, b) => {
|
|
1518
1523
|
if (a.id < b.id) return 1;
|