@zebec-network/exchange-card-sdk 1.9.0-dev.8 → 1.9.0-dev.9
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,31 +0,0 @@
|
|
|
1
|
-
import { type AuthTokenProvider, LedgerController, TokenStandardController, ValidatorController, type WalletSDK } from "@canton-network/wallet-sdk";
|
|
2
|
-
export interface CantonWallet {
|
|
3
|
-
partyId: string;
|
|
4
|
-
executeTransaction: (command: unknown, disclosedContractId: unknown[]) => Promise<string>;
|
|
5
|
-
}
|
|
6
|
-
export interface CantonConfig {
|
|
7
|
-
ledgerApiUrl: string;
|
|
8
|
-
validatorAppApiUrl: string;
|
|
9
|
-
}
|
|
10
|
-
export declare function createLedgerFactory(ledgerApiUrl: string): (userId: string, authTokenProvider: AuthTokenProvider, isAdmin: boolean) => LedgerController;
|
|
11
|
-
export declare function createValidatorFactory(validatorAppApiUrl: string): (userId: string, authTokenProvider: AuthTokenProvider) => ValidatorController;
|
|
12
|
-
export declare function createTokenStandardFactory(ledgerApiUrl: string, validatorAppApiUrl: string): (userId: string, authTokenProvider: AuthTokenProvider, isAdmin: boolean) => TokenStandardController;
|
|
13
|
-
export declare class CantonService {
|
|
14
|
-
readonly wallet: CantonWallet;
|
|
15
|
-
readonly cantonConfig: CantonConfig;
|
|
16
|
-
readonly cantonWalletSdk: WalletSDK;
|
|
17
|
-
private apiService;
|
|
18
|
-
constructor(wallet: CantonWallet, cantonConfig: CantonConfig, sdkOptions?: {
|
|
19
|
-
sandbox?: boolean;
|
|
20
|
-
});
|
|
21
|
-
connect(): Promise<void>;
|
|
22
|
-
fetchVault(symbol?: string): Promise<{
|
|
23
|
-
address: string;
|
|
24
|
-
tag?: string;
|
|
25
|
-
}>;
|
|
26
|
-
transferNative(params: {
|
|
27
|
-
amount: number | string;
|
|
28
|
-
instrumentId: string;
|
|
29
|
-
instrumentAdmin: string;
|
|
30
|
-
}): Promise<string>;
|
|
31
|
-
}
|
|
@@ -1,57 +1,103 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
// import {
|
|
3
|
+
// type AuthTokenProvider,
|
|
4
|
+
// LedgerController,
|
|
5
|
+
// localNetStaticConfig,
|
|
6
|
+
// TokenStandardController,
|
|
7
|
+
// ValidatorController,
|
|
8
|
+
// type WalletSDK,
|
|
9
|
+
// WalletSDKImpl,
|
|
10
|
+
// } from "@canton-network/wallet-sdk";
|
|
11
|
+
// import { ZebecCardAPIService } from "../helpers/apiHelpers";
|
|
12
|
+
// export interface CantonWallet {
|
|
13
|
+
// partyId: string;
|
|
14
|
+
// executeTransaction: (command: unknown, disclosedContractId: unknown[]) => Promise<string>;
|
|
15
|
+
// }
|
|
16
|
+
// export interface CantonConfig {
|
|
17
|
+
// ledgerApiUrl: string;
|
|
18
|
+
// validatorAppApiUrl: string;
|
|
19
|
+
// }
|
|
20
|
+
// export function createLedgerFactory(ledgerApiUrl: string) {
|
|
21
|
+
// return (userId: string, authTokenProvider: AuthTokenProvider, isAdmin: boolean) => {
|
|
22
|
+
// return new LedgerController(
|
|
23
|
+
// userId,
|
|
24
|
+
// new URL(ledgerApiUrl),
|
|
25
|
+
// undefined,
|
|
26
|
+
// isAdmin,
|
|
27
|
+
// authTokenProvider,
|
|
28
|
+
// );
|
|
29
|
+
// };
|
|
30
|
+
// }
|
|
31
|
+
// export function createValidatorFactory(validatorAppApiUrl: string) {
|
|
32
|
+
// return (userId: string, authTokenProvider: AuthTokenProvider) => {
|
|
33
|
+
// return new ValidatorController(userId, new URL(validatorAppApiUrl), authTokenProvider);
|
|
34
|
+
// };
|
|
35
|
+
// }
|
|
36
|
+
// export function createTokenStandardFactory(ledgerApiUrl: string, validatorAppApiUrl: string) {
|
|
37
|
+
// return (userId: string, authTokenProvider: AuthTokenProvider, isAdmin: boolean) => {
|
|
38
|
+
// return new TokenStandardController(
|
|
39
|
+
// userId,
|
|
40
|
+
// new URL(ledgerApiUrl),
|
|
41
|
+
// new URL(validatorAppApiUrl),
|
|
42
|
+
// undefined,
|
|
43
|
+
// authTokenProvider,
|
|
44
|
+
// isAdmin,
|
|
45
|
+
// );
|
|
46
|
+
// };
|
|
47
|
+
// }
|
|
48
|
+
// export class CantonService {
|
|
49
|
+
// readonly cantonWalletSdk: WalletSDK;
|
|
50
|
+
// private apiService: ZebecCardAPIService;
|
|
51
|
+
// constructor(
|
|
52
|
+
// readonly wallet: CantonWallet,
|
|
53
|
+
// readonly cantonConfig: CantonConfig,
|
|
54
|
+
// sdkOptions?: { sandbox?: boolean },
|
|
55
|
+
// ) {
|
|
56
|
+
// this.apiService = new ZebecCardAPIService(sdkOptions?.sandbox || false);
|
|
57
|
+
// this.cantonWalletSdk = new WalletSDKImpl().configure({
|
|
58
|
+
// logger: console,
|
|
59
|
+
// ledgerFactory: createLedgerFactory(cantonConfig.ledgerApiUrl),
|
|
60
|
+
// validatorFactory: createValidatorFactory(cantonConfig.validatorAppApiUrl),
|
|
61
|
+
// tokenStandardFactory: createTokenStandardFactory(
|
|
62
|
+
// cantonConfig.ledgerApiUrl,
|
|
63
|
+
// cantonConfig.validatorAppApiUrl,
|
|
64
|
+
// ),
|
|
65
|
+
// });
|
|
66
|
+
// }
|
|
67
|
+
// async connect() {
|
|
68
|
+
// await this.cantonWalletSdk.connect();
|
|
69
|
+
// }
|
|
70
|
+
// async fetchVault(symbol = "CANTON"): Promise<{ address: string; tag?: string }> {
|
|
71
|
+
// const data = await this.apiService.fetchVault(symbol);
|
|
72
|
+
// return data;
|
|
73
|
+
// }
|
|
74
|
+
// // methods for transfering natve assets
|
|
75
|
+
// async transferNative(params: {
|
|
76
|
+
// amount: number | string;
|
|
77
|
+
// instrumentId: string;
|
|
78
|
+
// instrumentAdmin: string;
|
|
79
|
+
// }) {
|
|
80
|
+
// const vault = await this.fetchVault("CANTON");
|
|
81
|
+
// const sender = this.wallet.partyId;
|
|
82
|
+
// const receiver = vault.address;
|
|
83
|
+
// const memo = vault.tag;
|
|
84
|
+
// // implement transfer logic here
|
|
85
|
+
// this.cantonWalletSdk.tokenStandard?.setTransferFactoryRegistryUrl(
|
|
86
|
+
// localNetStaticConfig.LOCALNET_REGISTRY_API_URL,
|
|
87
|
+
// );
|
|
88
|
+
// const [transferCommand, disclosedContracts] =
|
|
89
|
+
// // biome-ignore lint/style/noNonNullAssertion: we can be sure that tokenStandard is defined here since we set its factory in the SDK constructor
|
|
90
|
+
// await this.cantonWalletSdk.tokenStandard!.createTransfer(
|
|
91
|
+
// sender,
|
|
92
|
+
// receiver,
|
|
93
|
+
// params.amount.toString(),
|
|
94
|
+
// {
|
|
95
|
+
// instrumentId: params.instrumentId,
|
|
96
|
+
// instrumentAdmin: params.instrumentAdmin,
|
|
97
|
+
// },
|
|
98
|
+
// [],
|
|
99
|
+
// memo,
|
|
100
|
+
// );
|
|
101
|
+
// return this.wallet.executeTransaction(transferCommand, disclosedContracts);
|
|
102
|
+
// }
|
|
103
|
+
// }
|
package/dist/services/index.d.ts
CHANGED
package/dist/services/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from "./aleoService";
|
|
2
2
|
export * from "./algorandService";
|
|
3
3
|
export * from "./bobaService";
|
|
4
|
-
export * from "./cantonService";
|
|
4
|
+
// export * from "./cantonService";
|
|
5
5
|
export * from "./nearService";
|
|
6
6
|
export * from "./octaService";
|
|
7
7
|
export * from "./quaiService";
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "Zebec Network | Ashish Sapkota",
|
|
3
3
|
"dependencies": {
|
|
4
|
-
"@canton-network/wallet-sdk": "^0.21.1",
|
|
5
4
|
"@near-js/crypto": "^2.5.1",
|
|
6
5
|
"@near-js/providers": "^2.5.1",
|
|
7
6
|
"@near-js/transactions": "^2.5.1",
|
|
@@ -54,7 +53,7 @@
|
|
|
54
53
|
},
|
|
55
54
|
"repository": {
|
|
56
55
|
"type": "git",
|
|
57
|
-
"url": "git+
|
|
56
|
+
"url": "git+git@github.com:Zebec-Fintech-Labs/card-sdk-mono.git"
|
|
58
57
|
},
|
|
59
58
|
"scripts": {
|
|
60
59
|
"build": "npm run clean && tsc",
|
|
@@ -65,5 +64,5 @@
|
|
|
65
64
|
},
|
|
66
65
|
"type": "module",
|
|
67
66
|
"types": "dist/index.d.ts",
|
|
68
|
-
"version": "1.9.0-dev.
|
|
67
|
+
"version": "1.9.0-dev.9"
|
|
69
68
|
}
|