@ledgerhq/wallet-api-feature-flag-module 0.2.0-nightly.20260123024457
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/LICENSE.txt +21 -0
- package/lib/index.d.ts +24 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +46 -0
- package/lib/index.js.map +1 -0
- package/lib/types.d.ts +21 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +3 -0
- package/lib/types.js.map +1 -0
- package/lib-es/index.d.ts +24 -0
- package/lib-es/index.d.ts.map +1 -0
- package/lib-es/index.js +28 -0
- package/lib-es/index.js.map +1 -0
- package/lib-es/package.json +1 -0
- package/lib-es/types.d.ts +21 -0
- package/lib-es/types.d.ts.map +1 -0
- package/lib-es/types.js +2 -0
- package/lib-es/types.js.map +1 -0
- package/package.json +43 -0
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017-present Ledger https://www.ledger.com/
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CustomModule } from "@ledgerhq/wallet-api-client";
|
|
2
|
+
import { Feature } from "./types";
|
|
3
|
+
export * from "./types";
|
|
4
|
+
export declare class FeatureFlagModule extends CustomModule {
|
|
5
|
+
/**
|
|
6
|
+
* Fetch feature flags from Ledger Live.
|
|
7
|
+
*
|
|
8
|
+
* The Live App must declare which feature flags it can access via the
|
|
9
|
+
* `featureFlags` array in its manifest. Only declared flags will be returned.
|
|
10
|
+
*
|
|
11
|
+
* @param featureFlagIds - Array of feature flag IDs to fetch
|
|
12
|
+
* @returns A record mapping feature flag IDs to their values, or null if not found/unauthorized
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const result = await featureFlagModule.get(["stakePrograms", "earnLidoStaking"]);
|
|
17
|
+
* if (result.features.stakePrograms?.enabled) {
|
|
18
|
+
* // Feature is enabled
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
get(featureFlagIds: string[]): Promise<Record<string, Feature<unknown> | null>>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAA8C,OAAO,EAAE,MAAM,SAAS,CAAC;AAE9E,cAAc,SAAS,CAAC;AAExB,qBAAa,iBAAkB,SAAQ,YAAY;IACjD;;;;;;;;;;;;;;;;OAgBG;IACG,GAAG,CAAC,cAAc,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;CAStF"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.FeatureFlagModule = void 0;
|
|
18
|
+
const wallet_api_client_1 = require("@ledgerhq/wallet-api-client");
|
|
19
|
+
__exportStar(require("./types"), exports);
|
|
20
|
+
class FeatureFlagModule extends wallet_api_client_1.CustomModule {
|
|
21
|
+
/**
|
|
22
|
+
* Fetch feature flags from Ledger Live.
|
|
23
|
+
*
|
|
24
|
+
* The Live App must declare which feature flags it can access via the
|
|
25
|
+
* `featureFlags` array in its manifest. Only declared flags will be returned.
|
|
26
|
+
*
|
|
27
|
+
* @param featureFlagIds - Array of feature flag IDs to fetch
|
|
28
|
+
* @returns A record mapping feature flag IDs to their values, or null if not found/unauthorized
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const result = await featureFlagModule.get(["stakePrograms", "earnLidoStaking"]);
|
|
33
|
+
* if (result.features.stakePrograms?.enabled) {
|
|
34
|
+
* // Feature is enabled
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
async get(featureFlagIds) {
|
|
39
|
+
const result = await this.request("custom.featureFlags.get", {
|
|
40
|
+
featureFlagIds,
|
|
41
|
+
});
|
|
42
|
+
return result.features;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.FeatureFlagModule = FeatureFlagModule;
|
|
46
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mEAA2D;AAG3D,0CAAwB;AAExB,MAAa,iBAAkB,SAAQ,gCAAY;IACjD;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,CAAC,GAAG,CAAC,cAAwB;QAChC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAC/B,yBAAyB,EACzB;YACE,cAAc;SACf,CACF,CAAC;QACF,OAAO,MAAM,CAAC,QAAQ,CAAC;IACzB,CAAC;CACF;AA3BD,8CA2BC"}
|
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a feature flag value returned by Ledger Live.
|
|
3
|
+
* This is a simplified version of the Feature type for Live Apps.
|
|
4
|
+
*/
|
|
5
|
+
export type Feature<T = unknown> = {
|
|
6
|
+
/**
|
|
7
|
+
* If false, the feature is disabled
|
|
8
|
+
*/
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Additional parameters specific to this feature flag
|
|
12
|
+
*/
|
|
13
|
+
params?: T;
|
|
14
|
+
};
|
|
15
|
+
export type FeatureFlagGetParams = {
|
|
16
|
+
featureFlagIds: string[];
|
|
17
|
+
};
|
|
18
|
+
export type FeatureFlagGetResult = {
|
|
19
|
+
features: Record<string, Feature<unknown> | null>;
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,GAAG,OAAO,IAAI;IACjC;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;CACnD,CAAC"}
|
package/lib/types.js
ADDED
package/lib/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CustomModule } from "@ledgerhq/wallet-api-client";
|
|
2
|
+
import { Feature } from "./types";
|
|
3
|
+
export * from "./types";
|
|
4
|
+
export declare class FeatureFlagModule extends CustomModule {
|
|
5
|
+
/**
|
|
6
|
+
* Fetch feature flags from Ledger Live.
|
|
7
|
+
*
|
|
8
|
+
* The Live App must declare which feature flags it can access via the
|
|
9
|
+
* `featureFlags` array in its manifest. Only declared flags will be returned.
|
|
10
|
+
*
|
|
11
|
+
* @param featureFlagIds - Array of feature flag IDs to fetch
|
|
12
|
+
* @returns A record mapping feature flag IDs to their values, or null if not found/unauthorized
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const result = await featureFlagModule.get(["stakePrograms", "earnLidoStaking"]);
|
|
17
|
+
* if (result.features.stakePrograms?.enabled) {
|
|
18
|
+
* // Feature is enabled
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
get(featureFlagIds: string[]): Promise<Record<string, Feature<unknown> | null>>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAA8C,OAAO,EAAE,MAAM,SAAS,CAAC;AAE9E,cAAc,SAAS,CAAC;AAExB,qBAAa,iBAAkB,SAAQ,YAAY;IACjD;;;;;;;;;;;;;;;;OAgBG;IACG,GAAG,CAAC,cAAc,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;CAStF"}
|
package/lib-es/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { CustomModule } from "@ledgerhq/wallet-api-client";
|
|
2
|
+
export * from "./types";
|
|
3
|
+
export class FeatureFlagModule extends CustomModule {
|
|
4
|
+
/**
|
|
5
|
+
* Fetch feature flags from Ledger Live.
|
|
6
|
+
*
|
|
7
|
+
* The Live App must declare which feature flags it can access via the
|
|
8
|
+
* `featureFlags` array in its manifest. Only declared flags will be returned.
|
|
9
|
+
*
|
|
10
|
+
* @param featureFlagIds - Array of feature flag IDs to fetch
|
|
11
|
+
* @returns A record mapping feature flag IDs to their values, or null if not found/unauthorized
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const result = await featureFlagModule.get(["stakePrograms", "earnLidoStaking"]);
|
|
16
|
+
* if (result.features.stakePrograms?.enabled) {
|
|
17
|
+
* // Feature is enabled
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
async get(featureFlagIds) {
|
|
22
|
+
const result = await this.request("custom.featureFlags.get", {
|
|
23
|
+
featureFlagIds,
|
|
24
|
+
});
|
|
25
|
+
return result.features;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAG3D,cAAc,SAAS,CAAC;AAExB,MAAM,OAAO,iBAAkB,SAAQ,YAAY;IACjD;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,CAAC,GAAG,CAAC,cAAwB;QAChC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAC/B,yBAAyB,EACzB;YACE,cAAc;SACf,CACF,CAAC;QACF,OAAO,MAAM,CAAC,QAAQ,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "type": "module" }
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a feature flag value returned by Ledger Live.
|
|
3
|
+
* This is a simplified version of the Feature type for Live Apps.
|
|
4
|
+
*/
|
|
5
|
+
export type Feature<T = unknown> = {
|
|
6
|
+
/**
|
|
7
|
+
* If false, the feature is disabled
|
|
8
|
+
*/
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Additional parameters specific to this feature flag
|
|
12
|
+
*/
|
|
13
|
+
params?: T;
|
|
14
|
+
};
|
|
15
|
+
export type FeatureFlagGetParams = {
|
|
16
|
+
featureFlagIds: string[];
|
|
17
|
+
};
|
|
18
|
+
export type FeatureFlagGetResult = {
|
|
19
|
+
features: Record<string, Feature<unknown> | null>;
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,GAAG,OAAO,IAAI;IACjC;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;CACnD,CAAC"}
|
package/lib-es/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ledgerhq/wallet-api-feature-flag-module",
|
|
3
|
+
"version": "0.2.0-nightly.20260123024457",
|
|
4
|
+
"description": "Wallet-API Feature Flag Module for Ledger Live",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"Ledger"
|
|
8
|
+
],
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/LedgerHQ/ledger-live.git"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/LedgerHQ/ledger-live/issues"
|
|
15
|
+
},
|
|
16
|
+
"homepage": "https://github.com/LedgerHQ/ledger-live/tree/develop/libs/feature-flag-module",
|
|
17
|
+
"main": "lib/index.js",
|
|
18
|
+
"module": "lib-es/index.js",
|
|
19
|
+
"types": "lib/index.d.ts",
|
|
20
|
+
"files": [
|
|
21
|
+
"/lib",
|
|
22
|
+
"/lib-es"
|
|
23
|
+
],
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@ledgerhq/wallet-api-client": "^1.12.6",
|
|
29
|
+
"@ledgerhq/wallet-api-core": "^1.27.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/node": "^22.10.10"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"clean": "rimraf lib lib-es",
|
|
36
|
+
"build": "tsc && tsc -m esnext --moduleResolution bundler --outDir lib-es && node scripts/createModulePackage.mjs",
|
|
37
|
+
"prewatch": "pnpm build",
|
|
38
|
+
"watch": "tsc --watch",
|
|
39
|
+
"watch:es": "tsc --watch -m esnext --moduleResolution bundler --outDir lib-es",
|
|
40
|
+
"lint": "eslint ./src --no-error-on-unmatched-pattern --ext .ts,.tsx",
|
|
41
|
+
"lint:fix": "pnpm lint --fix"
|
|
42
|
+
}
|
|
43
|
+
}
|