@zebec-network/exchange-card-sdk 1.11.0-dev.1 → 1.11.0-dev.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.
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { Logger } from "@canton-network/core-types";
|
|
2
|
+
import { type AuthTokenProvider, ClientCredentialOAuthController, LedgerController, TokenStandardController, ValidatorController, type WalletSDK } from "@canton-network/wallet-sdk";
|
|
2
3
|
export declare const CANTON_NATIVE_INSTRUMENT_ID = "Amulet";
|
|
3
4
|
export declare const DEVNET_CANTON_NATIVE_INSTRUMENT_ADMIN = "DSO::1220be58c29e65de40bf273be1dc2b266d43a9a002ea5b18955aeef7aac881bb471a";
|
|
4
5
|
/**
|
|
@@ -53,6 +54,15 @@ export interface CantonConfig {
|
|
|
53
54
|
* Defaults to `localNetStaticConfig.LOCALNET_REGISTRY_API_URL` when omitted.
|
|
54
55
|
*/
|
|
55
56
|
registryApiUrl?: string | URL;
|
|
57
|
+
auth: {
|
|
58
|
+
configUrl: string;
|
|
59
|
+
userId?: string;
|
|
60
|
+
userSecret?: string;
|
|
61
|
+
adminId?: string;
|
|
62
|
+
adminSecret?: string;
|
|
63
|
+
scope?: string;
|
|
64
|
+
audience?: string;
|
|
65
|
+
};
|
|
56
66
|
}
|
|
57
67
|
/** Parameters for transferring native Canton coin (Amulet). */
|
|
58
68
|
export interface NativeTransferParams {
|
|
@@ -81,6 +91,7 @@ export interface TokenTransferParams {
|
|
|
81
91
|
export declare function createLedgerFactory(ledgerApiUrl: string): (userId: string, authTokenProvider: AuthTokenProvider, isAdmin: boolean) => LedgerController;
|
|
82
92
|
export declare function createValidatorFactory(validatorAppApiUrl: string): (userId: string, authTokenProvider: AuthTokenProvider) => ValidatorController;
|
|
83
93
|
export declare function createTokenStandardFactory(ledgerApiUrl: string, validatorAppApiUrl: string): (userId: string, authTokenProvider: AuthTokenProvider, isAdmin: boolean) => TokenStandardController;
|
|
94
|
+
export declare function createAuthFactory(configUrl: string, logger?: Logger, userId?: string, userSecret?: string, adminId?: string, adminSecret?: string, scope?: string, audience?: string): () => ClientCredentialOAuthController;
|
|
84
95
|
export declare class CantonService {
|
|
85
96
|
readonly wallet: CantonWalletAdapter;
|
|
86
97
|
readonly cantonConfig: CantonConfig;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LedgerController, localNetStaticConfig, TokenStandardController, ValidatorController, WalletSDKImpl, } from "@canton-network/wallet-sdk";
|
|
1
|
+
import { ClientCredentialOAuthController, LedgerController, localNetStaticConfig, TokenStandardController, ValidatorController, WalletSDKImpl, } from "@canton-network/wallet-sdk";
|
|
2
2
|
import { ZebecCardAPIService } from "../helpers/apiHelpers";
|
|
3
3
|
export const CANTON_NATIVE_INSTRUMENT_ID = "Amulet";
|
|
4
4
|
export const DEVNET_CANTON_NATIVE_INSTRUMENT_ADMIN = "DSO::1220be58c29e65de40bf273be1dc2b266d43a9a002ea5b18955aeef7aac881bb471a";
|
|
@@ -20,6 +20,9 @@ export function createTokenStandardFactory(ledgerApiUrl, validatorAppApiUrl) {
|
|
|
20
20
|
return new TokenStandardController(userId, new URL(ledgerApiUrl), new URL(validatorAppApiUrl), undefined, authTokenProvider, isAdmin);
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
+
export function createAuthFactory(configUrl, logger = console, userId, userSecret, adminId, adminSecret, scope, audience) {
|
|
24
|
+
return () => new ClientCredentialOAuthController(configUrl, logger, userId, userSecret, adminId, adminSecret, scope, audience);
|
|
25
|
+
}
|
|
23
26
|
// ---------------------------------------------------------------------------
|
|
24
27
|
// CantonService
|
|
25
28
|
// ---------------------------------------------------------------------------
|
|
@@ -38,6 +41,7 @@ export class CantonService {
|
|
|
38
41
|
: localNetStaticConfig.LOCALNET_REGISTRY_API_URL;
|
|
39
42
|
this.cantonWalletSdk = new WalletSDKImpl().configure({
|
|
40
43
|
logger: console,
|
|
44
|
+
authFactory: createAuthFactory(cantonConfig.auth.configUrl, console, cantonConfig.auth.userId, cantonConfig.auth.userSecret, cantonConfig.auth.adminId, cantonConfig.auth.adminSecret, cantonConfig.auth.scope, cantonConfig.auth.audience),
|
|
41
45
|
ledgerFactory: createLedgerFactory(cantonConfig.ledgerApiUrl),
|
|
42
46
|
validatorFactory: createValidatorFactory(cantonConfig.validatorAppApiUrl),
|
|
43
47
|
tokenStandardFactory: createTokenStandardFactory(cantonConfig.ledgerApiUrl, cantonConfig.validatorAppApiUrl),
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "Zebec Network | Ashish Sapkota",
|
|
3
3
|
"dependencies": {
|
|
4
|
+
"@canton-network/core-types": "^0.20.0",
|
|
4
5
|
"@canton-network/wallet-sdk": "^0.21.1",
|
|
5
6
|
"@near-js/crypto": "^2.5.1",
|
|
6
7
|
"@near-js/providers": "^2.5.1",
|
|
@@ -64,5 +65,5 @@
|
|
|
64
65
|
},
|
|
65
66
|
"type": "module",
|
|
66
67
|
"types": "dist/index.d.ts",
|
|
67
|
-
"version": "1.11.0-dev.
|
|
68
|
+
"version": "1.11.0-dev.2"
|
|
68
69
|
}
|