@fairmint/canton-fairmint-sdk 0.0.2
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 +64 -0
- package/dist/clients/index.d.ts +5 -0
- package/dist/clients/index.d.ts.map +1 -0
- package/dist/clients/index.js +21 -0
- package/dist/clients/index.js.map +1 -0
- package/dist/clients/json-api/index.d.ts +2 -0
- package/dist/clients/json-api/index.d.ts.map +1 -0
- package/dist/clients/json-api/index.js +18 -0
- package/dist/clients/json-api/index.js.map +1 -0
- package/dist/clients/json-api/sdkHelper.d.ts +27 -0
- package/dist/clients/json-api/sdkHelper.d.ts.map +1 -0
- package/dist/clients/json-api/sdkHelper.js +73 -0
- package/dist/clients/json-api/sdkHelper.js.map +1 -0
- package/dist/clients/postgres-db-api/cantonDbClient.d.ts +335 -0
- package/dist/clients/postgres-db-api/cantonDbClient.d.ts.map +1 -0
- package/dist/clients/postgres-db-api/cantonDbClient.js +2703 -0
- package/dist/clients/postgres-db-api/cantonDbClient.js.map +1 -0
- package/dist/clients/postgres-db-api/fairmintDbClient.d.ts +241 -0
- package/dist/clients/postgres-db-api/fairmintDbClient.d.ts.map +1 -0
- package/dist/clients/postgres-db-api/fairmintDbClient.js +3078 -0
- package/dist/clients/postgres-db-api/fairmintDbClient.js.map +1 -0
- package/dist/clients/postgres-db-api/index.d.ts +5 -0
- package/dist/clients/postgres-db-api/index.d.ts.map +1 -0
- package/dist/clients/postgres-db-api/index.js +25 -0
- package/dist/clients/postgres-db-api/index.js.map +1 -0
- package/dist/clients/postgres-db-api/postgresDbClient.d.ts +118 -0
- package/dist/clients/postgres-db-api/postgresDbClient.d.ts.map +1 -0
- package/dist/clients/postgres-db-api/postgresDbClient.js +212 -0
- package/dist/clients/postgres-db-api/postgresDbClient.js.map +1 -0
- package/dist/clients/postgres-db-api/types.d.ts +330 -0
- package/dist/clients/postgres-db-api/types.d.ts.map +1 -0
- package/dist/clients/postgres-db-api/types.js +30 -0
- package/dist/clients/postgres-db-api/types.js.map +1 -0
- package/dist/clients/shared/config.d.ts +19 -0
- package/dist/clients/shared/config.d.ts.map +1 -0
- package/dist/clients/shared/config.js +208 -0
- package/dist/clients/shared/config.js.map +1 -0
- package/dist/clients/shared/index.d.ts +3 -0
- package/dist/clients/shared/index.d.ts.map +1 -0
- package/dist/clients/shared/index.js +19 -0
- package/dist/clients/shared/index.js.map +1 -0
- package/dist/clients/shared/types.d.ts +29 -0
- package/dist/clients/shared/types.d.ts.map +1 -0
- package/dist/clients/shared/types.js +3 -0
- package/dist/clients/shared/types.js.map +1 -0
- package/dist/clients/validator-api/index.d.ts +4 -0
- package/dist/clients/validator-api/index.d.ts.map +1 -0
- package/dist/clients/validator-api/index.js +61 -0
- package/dist/clients/validator-api/index.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface ApiConfig {
|
|
2
|
+
API_URL: string;
|
|
3
|
+
GRANT_TYPE: string;
|
|
4
|
+
CLIENT_ID: string;
|
|
5
|
+
AUDIENCE?: string;
|
|
6
|
+
CLIENT_SECRET?: string;
|
|
7
|
+
USERNAME?: string;
|
|
8
|
+
PASSWORD?: string;
|
|
9
|
+
SCOPE?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ProviderConfigENVFormat {
|
|
12
|
+
PROVIDER_NAME: string;
|
|
13
|
+
AUTH_URL: string;
|
|
14
|
+
JSON_API: ApiConfig & {
|
|
15
|
+
PARTY_ID: string;
|
|
16
|
+
USER_ID: string;
|
|
17
|
+
};
|
|
18
|
+
VALIDATOR_API: ApiConfig & {
|
|
19
|
+
PARTY_ID: string;
|
|
20
|
+
USER_ID: string;
|
|
21
|
+
};
|
|
22
|
+
SCAN_API: ApiConfig;
|
|
23
|
+
}
|
|
24
|
+
export interface AuthResponse {
|
|
25
|
+
access_token: string;
|
|
26
|
+
}
|
|
27
|
+
export type NetworkType = string;
|
|
28
|
+
export type ProviderType = string;
|
|
29
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/clients/shared/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,uBAAuB;IACtC,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,SAAS,GAAG;QACpB,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,aAAa,EAAE,SAAS,GAAG;QACzB,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC;AACjC,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/clients/shared/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export * from '../shared/config';
|
|
2
|
+
import { ValidatorApiClient } from '@fairmint/canton-node-sdk';
|
|
3
|
+
export declare function createValidatorApiClient(network: 'mainnet' | 'devnet', providerType: 'intellect' | '5n'): ValidatorApiClient;
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/clients/validator-api/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AAEjC,OAAO,EAGL,kBAAkB,EAEnB,MAAM,2BAA2B,CAAC;AAEnC,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,SAAS,GAAG,QAAQ,EAC7B,YAAY,EAAE,WAAW,GAAG,IAAI,GAC/B,kBAAkB,CAiEpB"}
|
|
@@ -0,0 +1,61 @@
|
|
|
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.createValidatorApiClient = createValidatorApiClient;
|
|
18
|
+
__exportStar(require("../shared/config"), exports);
|
|
19
|
+
const canton_node_sdk_1 = require("@fairmint/canton-node-sdk");
|
|
20
|
+
function createValidatorApiClient(network, providerType) {
|
|
21
|
+
const envLoader = canton_node_sdk_1.EnvLoader.getInstance();
|
|
22
|
+
const apiUrl = envLoader.getApiUri('VALIDATOR_API', network, providerType);
|
|
23
|
+
const clientId = envLoader.getApiClientId('VALIDATOR_API', network, providerType);
|
|
24
|
+
const clientSecret = envLoader.getApiClientSecret('VALIDATOR_API', network, providerType);
|
|
25
|
+
const authUrl = envLoader.getAuthUrl(network, providerType);
|
|
26
|
+
const partyId = envLoader.getPartyId(network, providerType);
|
|
27
|
+
const userId = envLoader.getUserId(network, providerType);
|
|
28
|
+
const username = envLoader.getApiUsername('VALIDATOR_API', network, providerType);
|
|
29
|
+
const password = envLoader.getApiPassword('VALIDATOR_API', network, providerType);
|
|
30
|
+
if (!apiUrl || !authUrl) {
|
|
31
|
+
throw new Error('Missing required environment configuration for ValidatorApiClient');
|
|
32
|
+
}
|
|
33
|
+
// Validate authentication method
|
|
34
|
+
const hasClientCredentials = clientId && clientSecret;
|
|
35
|
+
const hasPasswordGrant = username && password && clientId;
|
|
36
|
+
if (!hasClientCredentials && !hasPasswordGrant) {
|
|
37
|
+
throw new Error('Must provide either clientId+clientSecret or clientId+username+password');
|
|
38
|
+
}
|
|
39
|
+
const clientConfig = {
|
|
40
|
+
network,
|
|
41
|
+
provider: providerType,
|
|
42
|
+
authUrl,
|
|
43
|
+
apis: {
|
|
44
|
+
VALIDATOR_API: {
|
|
45
|
+
apiUrl,
|
|
46
|
+
auth: {
|
|
47
|
+
grantType: clientSecret ? 'client_credentials' : 'password',
|
|
48
|
+
clientId,
|
|
49
|
+
clientSecret,
|
|
50
|
+
username,
|
|
51
|
+
password,
|
|
52
|
+
},
|
|
53
|
+
partyId,
|
|
54
|
+
userId,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
logger: new canton_node_sdk_1.FileLogger(),
|
|
58
|
+
};
|
|
59
|
+
return new canton_node_sdk_1.ValidatorApiClient(clientConfig);
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../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C1E,CAAC;IACJ,CAAC;IAED,MAAM,YAAY,GAAiB;QACjC,OAAO;QACP,QAAQ,EAAE,YAAY;QACtB,OAAO;QACP,IAAI,EAAE;YACJ,aAAa,EAAE;gBACb,MAAM;gBACN,IAAI,EAAE;oBACJ,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,UAAU;oBAC3D,QAAQ;oBACR,YAAY;oBACZ,QAAQ;oBACR,QAAQ;iBACT;gBACD,OAAO;gBACP,MAAM;aACP;SACF;QACD,MAAM,EAAE,IAAI,4BAAU,EAAE;KACzB,CAAC;IAEF,OAAO,IAAI,oCAAkB,CAAC,YAAY,CAAC,CAAC;AAC9C,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './clients';
|
|
2
|
+
export * from './clients/shared/types';
|
|
3
|
+
export * from './clients/shared/config';
|
|
4
|
+
export * from './clients/postgres-db-api/postgresDbClient';
|
|
5
|
+
export * from './clients/postgres-db-api/cantonDbClient';
|
|
6
|
+
export * from './clients/postgres-db-api/types';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,WAAW,CAAC;AAC1B,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4CAA4C,CAAC;AAC3D,cAAc,0CAA0C,CAAC;AACzD,cAAc,iCAAiC,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
// Re-export all clients and utilities
|
|
18
|
+
__exportStar(require("./clients"), exports);
|
|
19
|
+
__exportStar(require("./clients/shared/types"), exports);
|
|
20
|
+
__exportStar(require("./clients/shared/config"), exports);
|
|
21
|
+
__exportStar(require("./clients/postgres-db-api/postgresDbClient"), exports);
|
|
22
|
+
__exportStar(require("./clients/postgres-db-api/cantonDbClient"), exports);
|
|
23
|
+
__exportStar(require("./clients/postgres-db-api/types"), exports);
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sCAAsC;AACtC,4CAA0B;AAC1B,yDAAuC;AACvC,0DAAwC;AACxC,6EAA2D;AAC3D,2EAAyD;AACzD,kEAAgD"}
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fairmint/canton-fairmint-sdk",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "Shared SDK utilities for Canton blockchain integration",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc",
|
|
15
|
+
"clean": "rm -rf dist",
|
|
16
|
+
"typecheck": "tsc --noEmit",
|
|
17
|
+
"fix": "npm run lint:fix && npm run format:fix",
|
|
18
|
+
"lint": "eslint . --max-warnings=0",
|
|
19
|
+
"lint:fix": "eslint . --fix --max-warnings=0",
|
|
20
|
+
"format": "prettier --check .",
|
|
21
|
+
"format:fix": "prettier --write .",
|
|
22
|
+
"prepare-release": "ts-node scripts/prepare-release.ts",
|
|
23
|
+
"prepublishOnly": "npm run clean && npm run build"
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/fairmint/canton-fairmint-sdk.git"
|
|
28
|
+
},
|
|
29
|
+
"keywords": [
|
|
30
|
+
"canton",
|
|
31
|
+
"blockchain",
|
|
32
|
+
"daml",
|
|
33
|
+
"fairmint"
|
|
34
|
+
],
|
|
35
|
+
"author": "Fairmint",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://github.com/fairmint/canton-fairmint-sdk/issues"
|
|
39
|
+
},
|
|
40
|
+
"homepage": "https://github.com/fairmint/canton-fairmint-sdk#readme",
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@fairmint/canton-node-sdk": "0.0.135",
|
|
43
|
+
"@fairmint/open-captable-protocol-daml-js": "0.2.50",
|
|
44
|
+
"@open-captable-protocol/canton": "0.2.106",
|
|
45
|
+
"dotenv": "17.2.3",
|
|
46
|
+
"pg": "8.16.3"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
50
|
+
"@types/node": "24.9.2",
|
|
51
|
+
"@types/pg": "8.15.6",
|
|
52
|
+
"@typescript-eslint/eslint-plugin": "^8.33.0",
|
|
53
|
+
"@typescript-eslint/parser": "^8.33.0",
|
|
54
|
+
"eslint": "^9.28.0",
|
|
55
|
+
"eslint-plugin-unused-imports": "^4.1.4",
|
|
56
|
+
"prettier": "^3.5.3",
|
|
57
|
+
"ts-node": "^10.9.2",
|
|
58
|
+
"typescript": "5.9.3"
|
|
59
|
+
}
|
|
60
|
+
}
|