@zebec-network/exchange-card-sdk 1.9.0 → 1.10.0

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,7 +1,50 @@
1
- import { type TransactionOptions } from "@provablehq/aleo-types";
2
1
  import { AleoNetworkClient } from "@provablehq/sdk/mainnet.js";
3
2
  import { AleoNetworkClient as TestnetAleoNetworkClient } from "@provablehq/sdk/testnet.js";
4
3
  import { ZebecCardAPIService } from "../helpers/apiHelpers";
4
+ /**
5
+ * Supported Aleo networks
6
+ */
7
+ export declare enum Network {
8
+ MAINNET = "mainnet",
9
+ TESTNET = "testnet",
10
+ CANARY = "canary"
11
+ }
12
+ /**
13
+ * Transaction creation options
14
+ */
15
+ export interface TransactionOptions {
16
+ /**
17
+ * The program to execute
18
+ */
19
+ program: string;
20
+ /**
21
+ * The function to call
22
+ */
23
+ function: string;
24
+ /**
25
+ * The function inputs
26
+ */
27
+ inputs: string[];
28
+ /**
29
+ * The transaction fee to pay
30
+ */
31
+ fee?: number;
32
+ /**
33
+ * Record indices to use
34
+ */
35
+ recordIndices?: number[];
36
+ /**
37
+ * Whether the fee is private
38
+ */
39
+ privateFee?: boolean;
40
+ }
41
+ interface AleoNetworkClientOptions {
42
+ headers?: {
43
+ [key: string]: string;
44
+ };
45
+ proverUri?: string;
46
+ recordScannerUri?: string;
47
+ }
5
48
  export interface AleoWallet {
6
49
  address: string;
7
50
  decrypt: (cipherText: string) => Promise<string>;
@@ -52,7 +95,7 @@ export declare class AleoService {
52
95
  readonly sandbox: boolean;
53
96
  readonly apiService: ZebecCardAPIService;
54
97
  readonly networkClient: AleoNetworkClient | TestnetAleoNetworkClient;
55
- constructor(wallet: AleoWallet, options?: {
98
+ constructor(wallet: AleoWallet, aleoNetworkClientOptions?: AleoNetworkClientOptions, sdkOptions?: {
56
99
  sandbox?: boolean;
57
100
  });
58
101
  /**
@@ -88,3 +131,4 @@ export declare class AleoService {
88
131
  getPrivateBalance(): Promise<string>;
89
132
  getPrivateTokenBalance(tokenProgramId: string, tokenSymbol: string): Promise<string>;
90
133
  }
134
+ export {};
@@ -1,9 +1,17 @@
1
- import { Network } from "@provablehq/aleo-types";
2
1
  import { AleoNetworkClient, SealanceMerkleTree } from "@provablehq/sdk/mainnet.js";
3
2
  import { AleoNetworkClient as TestnetAleoNetworkClient, SealanceMerkleTree as TestnetSealanceMerkleTree, } from "@provablehq/sdk/testnet.js";
4
3
  import { ALEO_NETWORK_CLIENT_URL } from "../constants";
5
4
  import { ZebecCardAPIService } from "../helpers/apiHelpers";
6
5
  import { fromMicroUnits, getTokenBySymbol, toMicroUnits } from "../utils";
6
+ /**
7
+ * Supported Aleo networks
8
+ */
9
+ export var Network;
10
+ (function (Network) {
11
+ Network["MAINNET"] = "mainnet";
12
+ Network["TESTNET"] = "testnet";
13
+ Network["CANARY"] = "canary";
14
+ })(Network || (Network = {}));
7
15
  export const NETWORK_CONFIG = {
8
16
  [Network.MAINNET]: {
9
17
  explorer: "https://explorer.provable.com/transaction",
@@ -33,13 +41,13 @@ export class AleoService {
33
41
  sandbox;
34
42
  apiService;
35
43
  networkClient;
36
- constructor(wallet, options) {
44
+ constructor(wallet, aleoNetworkClientOptions, sdkOptions) {
37
45
  this.wallet = wallet;
38
- this.sandbox = options?.sandbox || false;
39
- this.apiService = new ZebecCardAPIService(options?.sandbox || false);
46
+ this.sandbox = sdkOptions?.sandbox || false;
47
+ this.apiService = new ZebecCardAPIService(sdkOptions?.sandbox || false);
40
48
  this.networkClient = this.sandbox
41
- ? new TestnetAleoNetworkClient(ALEO_NETWORK_CLIENT_URL)
42
- : new AleoNetworkClient(ALEO_NETWORK_CLIENT_URL);
49
+ ? new TestnetAleoNetworkClient(ALEO_NETWORK_CLIENT_URL, aleoNetworkClientOptions)
50
+ : new AleoNetworkClient(ALEO_NETWORK_CLIENT_URL, aleoNetworkClientOptions);
43
51
  }
44
52
  /**
45
53
  * Fetches the Bitcoin vault address.
@@ -122,7 +130,7 @@ export class AleoService {
122
130
  let inputs;
123
131
  switch (functionName) {
124
132
  case "transfer_public":
125
- inputs = [recipient, `${amountInMicroCredits}u64`];
133
+ inputs = [recipient, amountInMicroCredits];
126
134
  break;
127
135
  case "transfer_private": {
128
136
  const record = await this._getRecord(PROGRAM_NAME);
package/package.json CHANGED
@@ -6,8 +6,7 @@
6
6
  "@near-js/transactions": "^2.5.1",
7
7
  "@near-js/types": "^2.5.1",
8
8
  "@near-js/utils": "^2.5.1",
9
- "@provablehq/aleo-types": "^0.3.0-alpha.3",
10
- "@provablehq/sdk": "^0.9.15",
9
+ "@provablehq/sdk": "^0.9.16",
11
10
  "@stellar/stellar-sdk": "^14.4.3",
12
11
  "algosdk": "^3.4.0",
13
12
  "axios": "^1.11.0",
@@ -64,5 +63,5 @@
64
63
  },
65
64
  "type": "module",
66
65
  "types": "dist/index.d.ts",
67
- "version": "1.9.0"
66
+ "version": "1.10.0"
68
67
  }