@kynesyslabs/demosdk 2.2.36 → 2.2.38

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.
@@ -4,5 +4,5 @@ import RubicBridge from "./rubicBridge";
4
4
  export { BLOCKCHAIN_NAME, CROSS_CHAIN_TRADE_TYPE, CrossChainTrade, RubicSdkError, WrappedCrossChainTrade, } from "rubic-sdk";
5
5
  import { methods as NativeBridgeMethods } from "./nativeBridge";
6
6
  export { NativeBridgeMethods };
7
- export { BridgeOperation as NativeBridgeOperation, NativeBridgePayload, SupportedChain as NativeBridgeSupportedChain, SupportedStablecoin as NativeBridgeSupportedStablecoin, SupportedEVMChain as NativeBridgeSupportedEVMChain, supportedChains as NativeBridgeSupportedChains, supportedStablecoins as NativeBridgeSupportedStablecoins, supportedEVMChains as NativeBridgeSupportedEVMChains, usdcContracts as NativeBridgeUSDCContracts, usdcAbi as NativeBridgeUSDCAbi, } from "./nativeBridgeTypes";
7
+ export { BridgeOperation as NativeBridgeOperation, BridgeOperationCompiled as NativeBridgeOperationCompiled, SupportedChain as NativeBridgeSupportedChain, SupportedStablecoin as NativeBridgeSupportedStablecoin, SupportedEVMChain as NativeBridgeSupportedEVMChain, supportedChains as NativeBridgeSupportedChains, supportedStablecoins as NativeBridgeSupportedStablecoins, supportedEVMChains as NativeBridgeSupportedEVMChains, usdcContracts as NativeBridgeUSDCContracts, usdcAbi as NativeBridgeUSDCAbi, } from "./nativeBridgeTypes";
8
8
  export { RubicBridge };
@@ -1,12 +1,18 @@
1
- import { BridgeOperation } from "./nativeBridgeTypes";
1
+ import { BridgeOperationCompiled } from "./nativeBridgeTypes";
2
2
  import { Transaction } from "../types/blockchain/Transaction";
3
3
  export declare const methods: {
4
4
  /**
5
- * Generates a new operation, its corresponding Transaction and returns it
5
+ * Generates a new operation, ready to be sent to the node as a nodeCall
6
6
  * TODO Implement the params
7
+ * REVIEW Should we use the identity somehow or we keep using the private key?
7
8
  */
8
- generateOperation(): {
9
- operation: BridgeOperation;
10
- transaction: Transaction;
11
- };
9
+ generateOperation(privateKey: string): BridgeOperationCompiled;
10
+ /**
11
+ *
12
+ * @param compiled operation
13
+ * @param signature
14
+ * @param rpc
15
+ * @returns
16
+ */
17
+ generateOperationTx(compiled: BridgeOperationCompiled): Transaction;
12
18
  };
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.methods = void 0;
4
- const websdk_1 = require("../websdk");
4
+ const encryption_1 = require("../encryption");
5
5
  exports.methods = {
6
6
  /**
7
- * Generates a new operation, its corresponding Transaction and returns it
7
+ * Generates a new operation, ready to be sent to the node as a nodeCall
8
8
  * TODO Implement the params
9
+ * REVIEW Should we use the identity somehow or we keep using the private key?
9
10
  */
10
- generateOperation() {
11
+ generateOperation(privateKey) {
11
12
  // Defining the operation
12
13
  const operation = {
13
14
  demoAddress: "",
@@ -20,11 +21,25 @@ exports.methods = {
20
21
  txHash: "",
21
22
  status: "empty",
22
23
  };
23
- // Defining the transaction
24
- var transaction = websdk_1.demos.transactions.empty();
25
- // TODO Implement the operation
26
- // TODO Implement the transaction
27
- return { operation, transaction };
24
+ // TODO Generate the operation based on parameters
25
+ // REVIEW Sign the operation
26
+ let opHash = encryption_1.Hashing.sha256(JSON.stringify(operation));
27
+ let signature = encryption_1.Cryptography.sign(opHash, privateKey);
28
+ // TODO Call the node to send the operation
29
+ // TODO Await the response
30
+ // TODO Return the response
31
+ return null;
32
+ },
33
+ /**
34
+ *
35
+ * @param compiled operation
36
+ * @param signature
37
+ * @param rpc
38
+ * @returns
39
+ */
40
+ generateOperationTx(compiled) {
41
+ // TODO Implement the transaction once we have the compiled operation
42
+ return null;
28
43
  }
29
44
  };
30
45
  //# sourceMappingURL=nativeBridge.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nativeBridge.js","sourceRoot":"","sources":["../../../src/bridge/nativeBridge.ts"],"names":[],"mappings":";;;AAEA,qCAAgC;AAE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ED;;;;;;OAMG;IACH,mBAAmB,CAAC,QAAiC;QACjD,qEAAqE;QACrE,OAAO,IAAI,CAAA;IACf,CAAC;CACJ,CAAA"}
@@ -11,8 +11,20 @@ export type BridgeOperation = {
11
11
  txHash: string;
12
12
  status: "empty" | "pending" | "completed" | "failed";
13
13
  };
14
- export type NativeBridgePayload = {
15
- operation: BridgeOperation;
14
+ export type BridgeOperationCompiled = {
15
+ content: {
16
+ operation: BridgeOperation;
17
+ amountExpected: number;
18
+ } & ({
19
+ originChain: "EVM";
20
+ contractAddress: string;
21
+ contractABI: string[];
22
+ } | {
23
+ originChain: "SOLANA";
24
+ solanaAddress: string;
25
+ });
26
+ signature: string;
27
+ rpc: string;
16
28
  };
17
29
  export declare const supportedEVMChains: readonly ["eth", "polygon", "bsc", "arbitrum", "optimism", "avalanche", "base"];
18
30
  export declare const usdcContracts: {
@@ -26,6 +38,6 @@ export declare const usdcContracts: {
26
38
  SOLANA: string;
27
39
  };
28
40
  export declare const usdcAbi: string[];
29
- export type SupportedChain = typeof supportedChains[number];
30
- export type SupportedStablecoin = typeof supportedStablecoins[number];
31
- export type SupportedEVMChain = typeof supportedEVMChains[number];
41
+ export type SupportedChain = (typeof supportedChains)[number];
42
+ export type SupportedStablecoin = (typeof supportedStablecoins)[number];
43
+ export type SupportedEVMChain = (typeof supportedEVMChains)[number];
@@ -1 +1 @@
1
- {"version":3,"file":"nativeBridgeTypes.js","sourceRoot":"","sources":["../../../src/bridge/nativeBridgeTypes.ts"],"names":[],"mappings":";AAAA,8FAA8F;;;AAE9F,mCAAmC;AACtB,QAAA,eAAe,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAU,CAAA;AAC5C,QAAA,oBAAoB,GAAG,CAAC,MAAM,CAAU,CAAA;AAoBrD,2BAA2B;AACd,QAAA,kBAAkB,GAAG;IAC9B,KAAK;IACL,SAAS;IACT,KAAK;IACL,UAAU;IACV,UAAU;IACV,WAAW;IACX,MAAM;CACA,CAAA;AAEV,mEAAmE;A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D;IAC1D,0CAA0C;CAC7C,CAAA"}
@@ -9,8 +9,8 @@ import { INativePayload } from "../native";
9
9
  import { SubnetPayload } from "../../l2ps";
10
10
  import { IdentityPayload } from "../abstraction";
11
11
  import { InstantMessagingPayload } from "../instantMessaging";
12
- import { NativeBridgePayload } from "../../bridge/nativeBridgeTypes";
13
- export type TransactionContentData = ["web2Request", IWeb2Payload] | ["crosschainOperation", XMScript] | ["native", INativePayload] | ["demoswork", DemoScript] | ["subnet", SubnetPayload] | ["identity", IdentityPayload] | ["instantMessaging", InstantMessagingPayload] | ["nativeBridge", NativeBridgePayload];
12
+ import { BridgeOperationCompiled } from "../../bridge/nativeBridgeTypes";
13
+ export type TransactionContentData = ["web2Request", IWeb2Payload] | ["crosschainOperation", XMScript] | ["native", INativePayload] | ["demoswork", DemoScript] | ["subnet", SubnetPayload] | ["identity", IdentityPayload] | ["instantMessaging", InstantMessagingPayload] | ["nativeBridge", BridgeOperationCompiled];
14
14
  export interface TransactionContent {
15
15
  type: "web2Request" | "crosschainOperation" | "subnet" | "native" | "demoswork" | "genesis" | "NODE_ONLINE" | "identity" | "instantMessaging" | "nativeBridge";
16
16
  from: forge.pki.ed25519.BinaryBuffer | forge.pki.PublicKey | ISignature;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kynesyslabs/demosdk",
3
- "version": "2.2.36",
3
+ "version": "2.2.38",
4
4
  "main": "build/index.js",
5
5
  "types": "build/index.d.ts",
6
6
  "author": "Kynesys Labs",