example-js-sdk 0.0.5 → 0.0.7

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.
Files changed (125) hide show
  1. package/README.md +134 -52
  2. package/lib/OrbixSDK.d.ts +145 -0
  3. package/lib/{CarbonSDK.js → OrbixSDK.js} +52 -52
  4. package/lib/clients/ETHClient.d.ts +10 -10
  5. package/lib/clients/ETHClient.js +4 -4
  6. package/lib/clients/{CarbonQueryClient.d.ts → OrbixQueryClient.d.ts} +4 -4
  7. package/lib/clients/{CarbonQueryClient.js → OrbixQueryClient.js} +2 -2
  8. package/lib/clients/TokenClient.d.ts +26 -26
  9. package/lib/clients/TokenClient.js +12 -12
  10. package/lib/clients/index.d.ts +1 -1
  11. package/lib/clients/index.js +3 -3
  12. package/lib/codec/index.d.ts +1 -1
  13. package/lib/codec/index.js +253 -253
  14. package/lib/constant/eip712.d.ts +1 -1
  15. package/lib/constant/eip712.js +3 -3
  16. package/lib/constant/generic.d.ts +1 -1
  17. package/lib/constant/generic.js +3 -4
  18. package/lib/constant/ibc.d.ts +0 -1
  19. package/lib/constant/ibc.js +0 -35
  20. package/lib/constant/network.d.ts +7 -7
  21. package/lib/constant/network.js +48 -403
  22. package/lib/constant/node.js +2 -74
  23. package/lib/constant/token.js +6 -6
  24. package/lib/constant/web3Config.d.ts +5 -5
  25. package/lib/constant/web3Config.js +20 -24
  26. package/lib/index.d.ts +3 -3
  27. package/lib/index.js +7 -7
  28. package/lib/insights/balance.d.ts +2 -2
  29. package/lib/modules/admin.d.ts +23 -23
  30. package/lib/modules/admin.js +43 -43
  31. package/lib/modules/alliance.d.ts +6 -6
  32. package/lib/modules/alliance.js +5 -5
  33. package/lib/modules/bank.d.ts +2 -2
  34. package/lib/modules/bank.js +1 -1
  35. package/lib/modules/base.d.ts +4 -4
  36. package/lib/modules/bridge.d.ts +3 -3
  37. package/lib/modules/bridge.js +5 -5
  38. package/lib/modules/broker.d.ts +3 -3
  39. package/lib/modules/broker.js +2 -2
  40. package/lib/modules/coin.d.ts +8 -8
  41. package/lib/modules/coin.js +7 -7
  42. package/lib/modules/evm.d.ts +2 -2
  43. package/lib/modules/evm.js +1 -1
  44. package/lib/modules/evmmerge.d.ts +2 -2
  45. package/lib/modules/evmmerge.js +3 -3
  46. package/lib/modules/gov.d.ts +4 -4
  47. package/lib/modules/gov.js +3 -3
  48. package/lib/modules/grant.d.ts +4 -4
  49. package/lib/modules/grant.js +6 -6
  50. package/lib/modules/ibc.d.ts +3 -3
  51. package/lib/modules/ibc.js +2 -2
  52. package/lib/modules/leverage.d.ts +3 -3
  53. package/lib/modules/leverage.js +2 -2
  54. package/lib/modules/market.d.ts +15 -15
  55. package/lib/modules/market.js +7 -7
  56. package/lib/modules/order.d.ts +8 -8
  57. package/lib/modules/order.js +7 -7
  58. package/lib/modules/perpspool.d.ts +14 -14
  59. package/lib/modules/perpspool.js +23 -23
  60. package/lib/modules/position.d.ts +3 -3
  61. package/lib/modules/position.js +2 -2
  62. package/lib/modules/staking.d.ts +6 -6
  63. package/lib/modules/staking.js +3 -3
  64. package/lib/modules/subaccount.d.ts +4 -4
  65. package/lib/modules/subaccount.js +3 -3
  66. package/lib/provider/amino/types/admin.js +12 -12
  67. package/lib/provider/amino/types/bank.js +2 -2
  68. package/lib/provider/amino/types/bridge.js +3 -3
  69. package/lib/provider/amino/types/broker.js +2 -2
  70. package/lib/provider/amino/types/coin.js +5 -5
  71. package/lib/provider/amino/types/evm.js +2 -2
  72. package/lib/provider/amino/types/evmmerge.js +2 -2
  73. package/lib/provider/amino/types/feemarket.js +2 -2
  74. package/lib/provider/amino/types/gov.js +17 -17
  75. package/lib/provider/amino/types/grant.js +6 -6
  76. package/lib/provider/amino/types/group.js +4 -4
  77. package/lib/provider/amino/types/ibc.js +2 -2
  78. package/lib/provider/amino/types/leverage.js +2 -2
  79. package/lib/provider/amino/types/market.js +7 -7
  80. package/lib/provider/amino/types/order.js +5 -5
  81. package/lib/provider/amino/types/perpspool.js +11 -11
  82. package/lib/provider/amino/types/position.js +2 -2
  83. package/lib/provider/amino/types/staking.js +5 -5
  84. package/lib/provider/amino/types/subaccount.js +4 -4
  85. package/lib/provider/keplr/KeplrAccount.d.ts +3 -3
  86. package/lib/provider/keplr/KeplrAccount.js +11 -11
  87. package/lib/provider/leap/LeapAccount.d.ts +3 -3
  88. package/lib/provider/leap/LeapAccount.js +10 -10
  89. package/lib/provider/metamask/MetaMask.d.ts +8 -8
  90. package/lib/provider/metamask/MetaMask.js +17 -17
  91. package/lib/provider/rainbowKit/RainbowKitAccount.d.ts +7 -7
  92. package/lib/provider/rainbowKit/RainbowKitAccount.js +12 -12
  93. package/lib/provider/sdk/SDKProvider.d.ts +4 -4
  94. package/lib/util/alliance.js +2 -2
  95. package/lib/util/blockchain.d.ts +5 -5
  96. package/lib/util/blockchain.js +11 -11
  97. package/lib/util/eip712.d.ts +2 -2
  98. package/lib/util/eip712.js +1 -1
  99. package/lib/util/ethermint.d.ts +4 -4
  100. package/lib/util/ethermint.js +1 -1
  101. package/lib/util/external.d.ts +2 -2
  102. package/lib/util/gov.js +16 -16
  103. package/lib/util/ibc.js +2 -2
  104. package/lib/util/index.d.ts +1 -1
  105. package/lib/util/index.js +2 -2
  106. package/lib/util/legacyEIP712.js +1 -1
  107. package/lib/util/network.d.ts +1 -1
  108. package/lib/util/network.js +7 -7
  109. package/lib/util/provider.js +1 -1
  110. package/lib/util/token.d.ts +1 -1
  111. package/lib/util/token.js +1 -1
  112. package/lib/util/tx.d.ts +4 -4
  113. package/lib/util/tx.js +10 -10
  114. package/lib/wallet/{CarbonSigner.d.ts → OrbixSigner.d.ts} +19 -19
  115. package/lib/wallet/{CarbonSigner.js → OrbixSigner.js} +19 -19
  116. package/lib/wallet/{CarbonSigningClient.d.ts → OrbixSigningClient.d.ts} +3 -3
  117. package/lib/wallet/{CarbonSigningClient.js → OrbixSigningClient.js} +9 -9
  118. package/lib/wallet/{CarbonWallet.d.ts → OrbixWallet.d.ts} +38 -38
  119. package/lib/wallet/{CarbonWallet.js → OrbixWallet.js} +39 -39
  120. package/lib/wallet/index.d.ts +2 -2
  121. package/lib/wallet/index.js +2 -2
  122. package/package.json +2 -2
  123. package/lib/CarbonSDK.d.ts +0 -145
  124. /package/lib/codec/{carbon-models.d.ts → orbix-models.d.ts} +0 -0
  125. /package/lib/codec/{carbon-models.js → orbix-models.js} +0 -0
package/lib/util/tx.d.ts CHANGED
@@ -17,7 +17,7 @@ export declare enum BroadcastTxMode {
17
17
  BroadcastTxAsync = "async",
18
18
  BroadcastTxBlock = "block"
19
19
  }
20
- export interface CarbonSignerData extends SignerData {
20
+ export interface OrbixSignerData extends SignerData {
21
21
  timeoutHeight?: number;
22
22
  evmChainId?: string;
23
23
  }
@@ -28,7 +28,7 @@ export interface SignTxOpts {
28
28
  memo?: string;
29
29
  sequence?: number;
30
30
  accountNumber?: number;
31
- explicitSignerData?: Partial<CarbonSignerData>;
31
+ explicitSignerData?: Partial<OrbixSignerData>;
32
32
  processMsgs?: ProcessMsgsCallback;
33
33
  triggerMerge?: boolean;
34
34
  }
@@ -58,7 +58,7 @@ export declare enum ErrorType {
58
58
  BROADCAST_FAIL = "broadcast_fail",
59
59
  BLOCK_FAIL = "block_fail"
60
60
  }
61
- export declare class CarbonCustomError extends Error {
61
+ export declare class OrbixCustomError extends Error {
62
62
  readonly type?: ErrorType;
63
63
  readonly data?: any;
64
64
  constructor(msg: string, type?: ErrorType, data?: any);
@@ -553,7 +553,7 @@ export declare const Types: {
553
553
  };
554
554
  export declare const DEFAULT_SIGN_OPTS: SignTxOpts;
555
555
  export declare const TxGasCostTypeDefaultKey = "default_fee";
556
- export declare const TxMinGasPriceTypeDefaultKey = "swth";
556
+ export declare const TxMinGasPriceTypeDefaultKey = "fee";
557
557
  export declare const TxGasCostTypeMap: {};
558
558
  export declare const useSignDirectForMetamask: (messages: readonly EncodeObject[]) => boolean;
559
559
  export declare const isLibMsg: (typeUrl: string) => boolean;
package/lib/util/tx.js CHANGED
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.isLibMsg = exports.useSignDirectForMetamask = exports.TxGasCostTypeMap = exports.TxMinGasPriceTypeDefaultKey = exports.TxGasCostTypeDefaultKey = exports.DEFAULT_SIGN_OPTS = exports.Types = exports.CarbonCustomError = exports.ErrorType = exports.BroadcastTxMode = exports.getSender = exports.decode = void 0;
36
+ exports.isLibMsg = exports.useSignDirectForMetamask = exports.TxGasCostTypeMap = exports.TxMinGasPriceTypeDefaultKey = exports.TxGasCostTypeDefaultKey = exports.DEFAULT_SIGN_OPTS = exports.Types = exports.OrbixCustomError = exports.ErrorType = exports.BroadcastTxMode = exports.getSender = exports.decode = void 0;
37
37
  const codec_1 = require("../codec");
38
38
  const CosmosModels = __importStar(require("../codec/cosmos-models"));
39
39
  const constant_1 = require("../constant");
@@ -81,12 +81,12 @@ const decode = (bytes) => {
81
81
  if (!bytes)
82
82
  return bytes;
83
83
  const decodedTx = CosmosModels.Tx.Tx.decode((0, bytes_1.toUint8Array)(bytes));
84
- const carbonTx = { ...decodedTx, body: undefined };
84
+ const orbixTx = { ...decodedTx, body: undefined };
85
85
  if (decodedTx.body) {
86
- carbonTx.body = { ...decodedTx.body, messages: [] };
86
+ orbixTx.body = { ...decodedTx.body, messages: [] };
87
87
  for (const message of decodedTx.body.messages) {
88
88
  try {
89
- carbonTx.body.messages.push({
89
+ orbixTx.body.messages.push({
90
90
  typeUrl: message.typeUrl,
91
91
  value: decodeNestedMsg(codec_1.registry.decode(message)),
92
92
  });
@@ -94,14 +94,14 @@ const decode = (bytes) => {
94
94
  catch (error) {
95
95
  console.error(`failed to decode tx message: ${message?.typeUrl}`);
96
96
  console.error(error);
97
- carbonTx.body.messages.push(message);
97
+ orbixTx.body.messages.push(message);
98
98
  }
99
99
  }
100
100
  }
101
101
  else {
102
- delete carbonTx.body;
102
+ delete orbixTx.body;
103
103
  }
104
- return carbonTx;
104
+ return orbixTx;
105
105
  };
106
106
  exports.decode = decode;
107
107
  const getSender = (decodedTx, opts) => {
@@ -125,21 +125,21 @@ var ErrorType;
125
125
  ErrorType["BROADCAST_FAIL"] = "broadcast_fail";
126
126
  ErrorType["BLOCK_FAIL"] = "block_fail";
127
127
  })(ErrorType || (exports.ErrorType = ErrorType = {}));
128
- class CarbonCustomError extends Error {
128
+ class OrbixCustomError extends Error {
129
129
  constructor(msg, type, data) {
130
130
  super(msg);
131
131
  this.type = type;
132
132
  this.data = data;
133
133
  }
134
134
  }
135
- exports.CarbonCustomError = CarbonCustomError;
135
+ exports.OrbixCustomError = OrbixCustomError;
136
136
  exports.Types = codec_1.TxTypes;
137
137
  exports.DEFAULT_SIGN_OPTS = {
138
138
  fee: constant_1.DEFAULT_FEE,
139
139
  memo: "",
140
140
  };
141
141
  exports.TxGasCostTypeDefaultKey = "default_fee";
142
- exports.TxMinGasPriceTypeDefaultKey = "swth";
142
+ exports.TxMinGasPriceTypeDefaultKey = "fee";
143
143
  exports.TxGasCostTypeMap = {};
144
144
  const LibPackages = ['ibc', 'cosmos', 'alliance'];
145
145
  const BacklistedMessages = [
@@ -1,17 +1,17 @@
1
- import CarbonSDK from "../CarbonSDK";
1
+ import OrbixSDK from "../OrbixSDK";
2
2
  import { SignDoc } from "cosmjs-types/cosmos/tx/v1beta1/tx";
3
3
  import { CosmosLedger } from "../provider";
4
4
  import { AminoSignResponse, OfflineAminoSigner, Secp256k1Wallet, StdSignDoc } from "@cosmjs/amino";
5
5
  import { AccountData, DirectSecp256k1Wallet, DirectSignResponse, OfflineDirectSigner, OfflineSigner } from "@cosmjs/proto-signing";
6
6
  import { ethers } from "ethers";
7
- export declare enum CarbonSignerTypes {
7
+ export declare enum OrbixSignerTypes {
8
8
  Ledger = 0,
9
9
  PrivateKey = 1,
10
10
  BrowserInjected = 2,
11
11
  PublicKey = 3
12
12
  }
13
13
  export interface EvmSigner {
14
- readonly sendEvmTransaction: (api: CarbonSDK, req: ethers.providers.TransactionRequest) => Promise<string>;
14
+ readonly sendEvmTransaction: (api: OrbixSDK, req: ethers.providers.TransactionRequest) => Promise<string>;
15
15
  }
16
16
  export interface ArbitraryMessageSigner {
17
17
  readonly signMessage: (address: string, message: string) => Promise<string>;
@@ -20,22 +20,22 @@ export interface EIP712Signer extends EvmSigner {
20
20
  legacyEip712SignMode: boolean;
21
21
  readonly signLegacyEip712: (signerAddress: string, signDoc: StdSignDoc) => Promise<LegacyEIP712AminoSignResponse>;
22
22
  }
23
- export type CarbonSigner = DirectCarbonSigner | AminoCarbonSigner | CarbonEIP712Signer;
24
- export type CarbonEIP712Signer = (DirectCarbonSigner | AminoCarbonSigner) & EIP712Signer & ArbitraryMessageSigner;
25
- export type DirectCarbonSigner = OfflineDirectSigner & EvmSigner & ArbitraryMessageSigner & {
26
- type: CarbonSignerTypes;
23
+ export type OrbixSigner = DirectOrbixSigner | AminoOrbixSigner | OrbixEIP712Signer;
24
+ export type OrbixEIP712Signer = (DirectOrbixSigner | AminoOrbixSigner) & EIP712Signer & ArbitraryMessageSigner;
25
+ export type DirectOrbixSigner = OfflineDirectSigner & EvmSigner & ArbitraryMessageSigner & {
26
+ type: OrbixSignerTypes;
27
27
  };
28
- export type AminoCarbonSigner = OfflineAminoSigner & EvmSigner & ArbitraryMessageSigner & {
29
- type: CarbonSignerTypes;
28
+ export type AminoOrbixSigner = OfflineAminoSigner & EvmSigner & ArbitraryMessageSigner & {
29
+ type: OrbixSignerTypes;
30
30
  };
31
31
  export type LegacyEIP712AminoSignResponse = AminoSignResponse & {
32
32
  feePayer: string;
33
33
  };
34
- export declare function isCarbonEIP712Signer(signer: OfflineSigner): boolean;
35
- export declare class CarbonPrivateKeySigner implements DirectCarbonSigner, AminoCarbonSigner {
34
+ export declare function isOrbixEIP712Signer(signer: OfflineSigner): boolean;
35
+ export declare class OrbixPrivateKeySigner implements DirectOrbixSigner, AminoOrbixSigner {
36
36
  readonly privateKey: Uint8Array;
37
37
  readonly prefix: string;
38
- type: CarbonSignerTypes;
38
+ type: OrbixSignerTypes;
39
39
  wallet?: DirectSecp256k1Wallet;
40
40
  aminoWallet?: Secp256k1Wallet;
41
41
  constructor(privateKey: Uint8Array, prefix: string);
@@ -44,24 +44,24 @@ export declare class CarbonPrivateKeySigner implements DirectCarbonSigner, Amino
44
44
  getAccounts(): Promise<readonly AccountData[]>;
45
45
  signAmino(signerAddress: string, signDoc: StdSignDoc): Promise<AminoSignResponse>;
46
46
  signDirect(signerAddress: string, signDoc: SignDoc): Promise<DirectSignResponse>;
47
- sendEvmTransaction(api: CarbonSDK, req: ethers.providers.TransactionRequest): Promise<string>;
47
+ sendEvmTransaction(api: OrbixSDK, req: ethers.providers.TransactionRequest): Promise<string>;
48
48
  signMessage(address: string, message: string): Promise<string>;
49
49
  }
50
- export declare class CarbonNonSigner implements DirectCarbonSigner {
51
- type: CarbonSignerTypes;
50
+ export declare class OrbixNonSigner implements DirectOrbixSigner {
51
+ type: OrbixSignerTypes;
52
52
  getAccounts(): Promise<readonly AccountData[]>;
53
53
  signDirect(): Promise<DirectSignResponse>;
54
- sendEvmTransaction(api: CarbonSDK, req: ethers.providers.TransactionRequest): Promise<string>;
54
+ sendEvmTransaction(api: OrbixSDK, req: ethers.providers.TransactionRequest): Promise<string>;
55
55
  signMessage(address: string, message: string): Promise<string>;
56
56
  }
57
- export declare class CarbonLedgerSigner implements AminoCarbonSigner {
57
+ export declare class OrbixLedgerSigner implements AminoOrbixSigner {
58
58
  readonly ledger: CosmosLedger;
59
- type: CarbonSignerTypes;
59
+ type: OrbixSignerTypes;
60
60
  account?: AccountData;
61
61
  retrieveAccount(): Promise<AccountData>;
62
62
  getAccounts(): Promise<readonly AccountData[]>;
63
63
  signAmino(_: string, doc: StdSignDoc): Promise<AminoSignResponse>;
64
- sendEvmTransaction(api: CarbonSDK, req: ethers.providers.TransactionRequest): Promise<string>;
64
+ sendEvmTransaction(api: OrbixSDK, req: ethers.providers.TransactionRequest): Promise<string>;
65
65
  signMessage(_: string, message: string): Promise<string>;
66
66
  constructor(ledger: CosmosLedger);
67
67
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CarbonLedgerSigner = exports.CarbonNonSigner = exports.CarbonPrivateKeySigner = exports.CarbonSignerTypes = void 0;
4
- exports.isCarbonEIP712Signer = isCarbonEIP712Signer;
3
+ exports.OrbixLedgerSigner = exports.OrbixNonSigner = exports.OrbixPrivateKeySigner = exports.OrbixSignerTypes = void 0;
4
+ exports.isOrbixEIP712Signer = isOrbixEIP712Signer;
5
5
  const constant_1 = require("../constant");
6
6
  const ethermint_1 = require("../util/ethermint");
7
7
  const generic_1 = require("../util/generic");
@@ -9,21 +9,21 @@ const message_1 = require("../util/message");
9
9
  const amino_1 = require("@cosmjs/amino");
10
10
  const proto_signing_1 = require("@cosmjs/proto-signing");
11
11
  const ethers_1 = require("ethers");
12
- var CarbonSignerTypes;
13
- (function (CarbonSignerTypes) {
14
- CarbonSignerTypes[CarbonSignerTypes["Ledger"] = 0] = "Ledger";
15
- CarbonSignerTypes[CarbonSignerTypes["PrivateKey"] = 1] = "PrivateKey";
16
- CarbonSignerTypes[CarbonSignerTypes["BrowserInjected"] = 2] = "BrowserInjected";
17
- CarbonSignerTypes[CarbonSignerTypes["PublicKey"] = 3] = "PublicKey";
18
- })(CarbonSignerTypes || (exports.CarbonSignerTypes = CarbonSignerTypes = {}));
19
- function isCarbonEIP712Signer(signer) {
12
+ var OrbixSignerTypes;
13
+ (function (OrbixSignerTypes) {
14
+ OrbixSignerTypes[OrbixSignerTypes["Ledger"] = 0] = "Ledger";
15
+ OrbixSignerTypes[OrbixSignerTypes["PrivateKey"] = 1] = "PrivateKey";
16
+ OrbixSignerTypes[OrbixSignerTypes["BrowserInjected"] = 2] = "BrowserInjected";
17
+ OrbixSignerTypes[OrbixSignerTypes["PublicKey"] = 3] = "PublicKey";
18
+ })(OrbixSignerTypes || (exports.OrbixSignerTypes = OrbixSignerTypes = {}));
19
+ function isOrbixEIP712Signer(signer) {
20
20
  return signer.signLegacyEip712 !== undefined;
21
21
  }
22
- class CarbonPrivateKeySigner {
22
+ class OrbixPrivateKeySigner {
23
23
  constructor(privateKey, prefix) {
24
24
  this.privateKey = privateKey;
25
25
  this.prefix = prefix;
26
- this.type = CarbonSignerTypes.PrivateKey;
26
+ this.type = OrbixSignerTypes.PrivateKey;
27
27
  }
28
28
  async initWallet() {
29
29
  if (!this.wallet)
@@ -63,10 +63,10 @@ class CarbonPrivateKeySigner {
63
63
  return Buffer.from(signedDoc.signature.signature, 'base64').toString('hex');
64
64
  }
65
65
  }
66
- exports.CarbonPrivateKeySigner = CarbonPrivateKeySigner;
67
- class CarbonNonSigner {
66
+ exports.OrbixPrivateKeySigner = OrbixPrivateKeySigner;
67
+ class OrbixNonSigner {
68
68
  constructor() {
69
- this.type = CarbonSignerTypes.PublicKey;
69
+ this.type = OrbixSignerTypes.PublicKey;
70
70
  }
71
71
  async getAccounts() {
72
72
  throw new Error("signing not available");
@@ -81,9 +81,9 @@ class CarbonNonSigner {
81
81
  throw new Error("signing not available");
82
82
  }
83
83
  }
84
- exports.CarbonNonSigner = CarbonNonSigner;
84
+ exports.OrbixNonSigner = OrbixNonSigner;
85
85
  // Uses amino because ledger does not work with protobuf yet
86
- class CarbonLedgerSigner {
86
+ class OrbixLedgerSigner {
87
87
  async retrieveAccount() {
88
88
  if (!this.account) {
89
89
  const address = await this.ledger.getCosmosAddress();
@@ -125,7 +125,7 @@ class CarbonLedgerSigner {
125
125
  }
126
126
  constructor(ledger) {
127
127
  this.ledger = ledger;
128
- this.type = CarbonSignerTypes.Ledger;
128
+ this.type = OrbixSignerTypes.Ledger;
129
129
  }
130
130
  }
131
- exports.CarbonLedgerSigner = CarbonLedgerSigner;
131
+ exports.OrbixLedgerSigner = OrbixLedgerSigner;
@@ -1,5 +1,5 @@
1
1
  import { TxRaw } from "../codec/cosmos/tx/v1beta1/tx";
2
- import { CarbonSignerData } from "../util/tx";
2
+ import { OrbixSignerData } from "../util/tx";
3
3
  import { AminoMsg } from "@cosmjs/amino";
4
4
  import { EncodeObject, OfflineSigner, Registry } from "@cosmjs/proto-signing";
5
5
  import { AminoTypes, GasPrice, SigningStargateClientOptions, StargateClient, StdFee } from "@cosmjs/stargate";
@@ -14,7 +14,7 @@ export interface StdSignDoc {
14
14
  readonly timeout_height: string;
15
15
  }
16
16
  export declare function makeSignDocAmino(msgs: readonly AminoMsg[], fee: StdFee, chainId: string, memo: string | undefined, accountNumber: number | string, sequence: number | string, timeoutHeight?: number | string): StdSignDoc;
17
- export declare class CarbonSigningClient extends StargateClient {
17
+ export declare class OrbixSigningClient extends StargateClient {
18
18
  readonly signer: OfflineSigner;
19
19
  readonly options: SigningStargateClientOptions;
20
20
  readonly registry: Registry;
@@ -34,7 +34,7 @@ export declare class CarbonSigningClient extends StargateClient {
34
34
  * from the chain. This is needed when signing for a multisig account, but it also allows for offline signing
35
35
  * (See the SigningStargateClient.offline constructor).
36
36
  */
37
- sign(signerAddress: string, messages: readonly EncodeObject[], fee: StdFee, memo: string, signerData: CarbonSignerData, granterAddress?: string): Promise<TxRaw>;
37
+ sign(signerAddress: string, messages: readonly EncodeObject[], fee: StdFee, memo: string, signerData: OrbixSignerData, granterAddress?: string): Promise<TxRaw>;
38
38
  private signDirect;
39
39
  private signAmino;
40
40
  private signLegacyEip712;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.CarbonSigningClient = void 0;
6
+ exports.OrbixSigningClient = void 0;
7
7
  exports.makeSignDocAmino = makeSignDocAmino;
8
8
  const codec_1 = require("../codec");
9
9
  const tx_1 = require("../codec/cosmos/tx/v1beta1/tx");
@@ -17,7 +17,7 @@ const proto_signing_1 = require("@cosmjs/proto-signing");
17
17
  const stargate_1 = require("@cosmjs/stargate");
18
18
  const long_1 = __importDefault(require("long"));
19
19
  const provider_1 = require("../provider");
20
- const CarbonSigner_1 = require("./CarbonSigner");
20
+ const OrbixSigner_1 = require("./OrbixSigner");
21
21
  // Added SignMode enum from cosmjs-types to resolve build error
22
22
  var SignMode;
23
23
  (function (SignMode) {
@@ -56,7 +56,7 @@ function makeSignDocAmino(msgs, fee, chainId, memo, accountNumber, sequence, tim
56
56
  timeout_height: timeoutHeightStr,
57
57
  };
58
58
  }
59
- class CarbonSigningClient extends stargate_1.StargateClient {
59
+ class OrbixSigningClient extends stargate_1.StargateClient {
60
60
  constructor(tmClient, signer, options = {}) {
61
61
  super(tmClient, options);
62
62
  this.signer = signer;
@@ -81,7 +81,7 @@ class CarbonSigningClient extends stargate_1.StargateClient {
81
81
  * (See the SigningStargateClient.offline constructor).
82
82
  */
83
83
  async sign(signerAddress, messages, fee, memo, signerData, granterAddress) {
84
- if ((0, CarbonSigner_1.isCarbonEIP712Signer)(this.signer)) {
84
+ if ((0, OrbixSigner_1.isOrbixEIP712Signer)(this.signer)) {
85
85
  if (this.signer.legacyEip712SignMode) {
86
86
  return this.signLegacyEip712(signerAddress, messages, fee, memo, signerData);
87
87
  }
@@ -100,11 +100,11 @@ class CarbonSigningClient extends stargate_1.StargateClient {
100
100
  async signDirect(signerAddress, messages, fee, memo, { accountNumber, sequence, chainId, timeoutHeight }, granterAddress) {
101
101
  const signer = this.signer;
102
102
  const accountFromSigner = (await this.signer.getAccounts()).find((account) => account.address === signerAddress);
103
- if (!(0, CarbonSigner_1.isCarbonEIP712Signer)(this.signer) && !accountFromSigner) {
103
+ if (!(0, OrbixSigner_1.isOrbixEIP712Signer)(this.signer) && !accountFromSigner) {
104
104
  throw new Error("Failed to retrieve account from signer");
105
105
  }
106
106
  const pubKeyBz = accountFromSigner ? accountFromSigner.pubkey : (await this.signer.getAccounts())[0].pubkey;
107
- const pubkey = (0, CarbonSigner_1.isCarbonEIP712Signer)(this.signer) ? (0, ethermint_1.encodeAnyEthSecp256k1PubKey)(pubKeyBz) : (0, proto_signing_1.encodePubkey)((0, amino_1.encodeSecp256k1Pubkey)(pubKeyBz));
107
+ const pubkey = (0, OrbixSigner_1.isOrbixEIP712Signer)(this.signer) ? (0, ethermint_1.encodeAnyEthSecp256k1PubKey)(pubKeyBz) : (0, proto_signing_1.encodePubkey)((0, amino_1.encodeSecp256k1Pubkey)(pubKeyBz));
108
108
  const txBodyEncodeObject = {
109
109
  typeUrl: "/cosmos.tx.v1beta1.TxBody",
110
110
  value: {
@@ -129,11 +129,11 @@ class CarbonSigningClient extends stargate_1.StargateClient {
129
129
  async signAmino(signerAddress, messages, fee, memo, { accountNumber, sequence, chainId, timeoutHeight }, granterAddress) {
130
130
  const signer = this.signer;
131
131
  const accountFromSigner = (await this.signer.getAccounts()).find((account) => account.address === signerAddress);
132
- if (!(0, CarbonSigner_1.isCarbonEIP712Signer)(this.signer) && !accountFromSigner) {
132
+ if (!(0, OrbixSigner_1.isOrbixEIP712Signer)(this.signer) && !accountFromSigner) {
133
133
  throw new Error("Failed to retrieve account from signer");
134
134
  }
135
135
  const pubKeyBz = accountFromSigner ? accountFromSigner.pubkey : (await this.signer.getAccounts())[0].pubkey;
136
- const pubkey = (0, CarbonSigner_1.isCarbonEIP712Signer)(this.signer) ? (0, ethermint_1.encodeAnyEthSecp256k1PubKey)(pubKeyBz) : (0, proto_signing_1.encodePubkey)((0, amino_1.encodeSecp256k1Pubkey)(pubKeyBz));
136
+ const pubkey = (0, OrbixSigner_1.isOrbixEIP712Signer)(this.signer) ? (0, ethermint_1.encodeAnyEthSecp256k1PubKey)(pubKeyBz) : (0, proto_signing_1.encodePubkey)((0, amino_1.encodeSecp256k1Pubkey)(pubKeyBz));
137
137
  const signMode = SignMode.SIGN_MODE_LEGACY_AMINO_JSON;
138
138
  const msgs = messages.map((msg) => this.aminoTypes.toAmino(msg));
139
139
  const signDoc = makeSignDocAmino(msgs, fee, chainId, memo, accountNumber, sequence, timeoutHeight ?? 0);
@@ -198,4 +198,4 @@ class CarbonSigningClient extends stargate_1.StargateClient {
198
198
  });
199
199
  }
200
200
  }
201
- exports.CarbonSigningClient = CarbonSigningClient;
201
+ exports.OrbixSigningClient = OrbixSigningClient;
@@ -1,9 +1,9 @@
1
- import { OverrideConfig } from "../CarbonSDK";
2
- import { CarbonQueryClient } from "../clients";
1
+ import { OverrideConfig } from "../OrbixSDK";
2
+ import { OrbixQueryClient } from "../clients";
3
3
  import GasFee from "../clients/GasFee";
4
4
  import { Network, NetworkConfig, SupportedEip6963Provider } from "../constant";
5
5
  import { ProviderAgent } from "../constant/walletProvider";
6
- import { CarbonTx } from "../util";
6
+ import { OrbixTx } from "../util";
7
7
  import { AccessTokenResponse, GrantRequest } from "../util/auth";
8
8
  import { SmartWalletBlockchain } from "../util/blockchain";
9
9
  import { BroadcastTxMode } from "../util/tx";
@@ -13,9 +13,9 @@ import { Account, DeliverTxResponse } from "@cosmjs/stargate";
13
13
  import { Tendermint37Client } from "@cosmjs/tendermint-rpc";
14
14
  import { BroadcastTxAsyncResponse, BroadcastTxSyncResponse, TxResponse } from "@cosmjs/tendermint-rpc/build/tendermint37/responses";
15
15
  import { TxRaw as StargateTxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx";
16
- import { CarbonSigner, CarbonSignerTypes } from "./CarbonSigner";
17
- import { CarbonSigningClient } from "./CarbonSigningClient";
18
- export interface CarbonWalletGenericOpts {
16
+ import { OrbixSigner, OrbixSignerTypes } from "./OrbixSigner";
17
+ import { OrbixSigningClient } from "./OrbixSigningClient";
18
+ export interface OrbixWalletGenericOpts {
19
19
  tmClient?: Tendermint37Client;
20
20
  txDefaultBroadcastMode?: BroadcastTxMode;
21
21
  network?: Network;
@@ -33,27 +33,27 @@ export interface CarbonWalletGenericOpts {
33
33
  /**
34
34
  * Optional callback that will be called before signing is requested/executed.
35
35
  */
36
- onRequestSign?: CarbonWallet.OnRequestSignCallback;
36
+ onRequestSign?: OrbixWallet.OnRequestSignCallback;
37
37
  /**
38
38
  * Optional callback that will be called when signing is complete.
39
39
  */
40
- onSignComplete?: CarbonWallet.OnSignCompleteCallback;
40
+ onSignComplete?: OrbixWallet.OnSignCompleteCallback;
41
41
  /**
42
42
  * Optional callback that will be called after tx is broadcast successful.
43
43
  */
44
- onBroadcastTxSuccess?: CarbonWallet.OnBroadcastTxSuccessCallback;
44
+ onBroadcastTxSuccess?: OrbixWallet.OnBroadcastTxSuccessCallback;
45
45
  /**
46
46
  * Optional callback that will be called if tx broadcast fails.
47
47
  */
48
- onBroadcastTxFail?: CarbonWallet.OnBroadcastTxFailCallback;
48
+ onBroadcastTxFail?: OrbixWallet.OnBroadcastTxFailCallback;
49
49
  /**
50
50
  * Optional callback that will be called before authentication is requested
51
51
  */
52
- onRequestAuth?: CarbonWallet.OnRequestAuthCallback;
52
+ onRequestAuth?: OrbixWallet.OnRequestAuthCallback;
53
53
  /**
54
54
  * Optional callback that will be called after authentication is complete
55
55
  */
56
- onAuthComplete?: CarbonWallet.OnAuthComplete;
56
+ onAuthComplete?: OrbixWallet.OnAuthComplete;
57
57
  }
58
58
  export interface AuthInfo {
59
59
  message: string;
@@ -75,7 +75,7 @@ type PrivateKeyOpts = {
75
75
  };
76
76
  type CustomSignerOpts = {
77
77
  mode: "customSigner";
78
- signer: CarbonSigner;
78
+ signer: OrbixSigner;
79
79
  publicKeyBase64: string;
80
80
  };
81
81
  type ViewOnlyOpts = {
@@ -88,7 +88,7 @@ type QROpts = {
88
88
  granter: string;
89
89
  expiry: Date;
90
90
  };
91
- export type CarbonWalletInitOpts = CarbonWalletGenericOpts & (MnemonicOpts | PrivateKeyOpts | CustomSignerOpts | ViewOnlyOpts | QROpts);
91
+ export type OrbixWalletInitOpts = OrbixWalletGenericOpts & (MnemonicOpts | PrivateKeyOpts | CustomSignerOpts | ViewOnlyOpts | QROpts);
92
92
  export interface AccountInfo extends Account {
93
93
  chainId: string;
94
94
  }
@@ -96,20 +96,20 @@ export interface Grantee {
96
96
  expiry: Date;
97
97
  signer: OfflineDirectSigner;
98
98
  }
99
- export declare class CarbonWallet {
99
+ export declare class OrbixWallet {
100
100
  network: Network;
101
101
  configOverride: Partial<NetworkConfig>;
102
102
  networkConfig: NetworkConfig;
103
- onRequestSign?: CarbonWallet.OnRequestSignCallback;
104
- onSignComplete?: CarbonWallet.OnSignCompleteCallback;
105
- onBroadcastTxSuccess?: CarbonWallet.OnBroadcastTxSuccessCallback;
106
- onBroadcastTxFail?: CarbonWallet.OnBroadcastTxFailCallback;
107
- onRequestAuth?: CarbonWallet.OnRequestAuthCallback;
108
- onAuthComplete?: CarbonWallet.OnAuthComplete;
103
+ onRequestSign?: OrbixWallet.OnRequestSignCallback;
104
+ onSignComplete?: OrbixWallet.OnSignCompleteCallback;
105
+ onBroadcastTxSuccess?: OrbixWallet.OnBroadcastTxSuccessCallback;
106
+ onBroadcastTxFail?: OrbixWallet.OnBroadcastTxFailCallback;
107
+ onRequestAuth?: OrbixWallet.OnRequestAuthCallback;
108
+ onAuthComplete?: OrbixWallet.OnAuthComplete;
109
109
  defaultTimeoutBlocks: number;
110
110
  mnemonic?: string;
111
111
  privateKey?: Buffer;
112
- signer: CarbonSigner;
112
+ signer: OrbixSigner;
113
113
  bech32Address: string;
114
114
  evmBech32Address: string;
115
115
  hexAddress: string;
@@ -117,7 +117,7 @@ export declare class CarbonWallet {
117
117
  accountMerged?: boolean;
118
118
  triggerMerge?: boolean;
119
119
  publicKey: Buffer;
120
- query?: CarbonQueryClient;
120
+ query?: OrbixQueryClient;
121
121
  txDefaultBroadCastMode?: BroadcastTxMode;
122
122
  initialized: boolean;
123
123
  accountInfo?: AccountInfo;
@@ -135,8 +135,8 @@ export declare class CarbonWallet {
135
135
  private sequenceInvalidated;
136
136
  private txSignManager;
137
137
  private txDispatchManager;
138
- constructor(opts: CarbonWalletInitOpts);
139
- initialize(queryClient: CarbonQueryClient, gasFee: GasFee, fallbackConfig?: OverrideConfig | null, opts?: CarbonWalletGenericOpts): Promise<CarbonWallet>;
138
+ constructor(opts: OrbixWalletInitOpts);
139
+ initialize(queryClient: OrbixQueryClient, gasFee: GasFee, fallbackConfig?: OverrideConfig | null, opts?: OrbixWalletGenericOpts): Promise<OrbixWallet>;
140
140
  reloadJwtToken(request?: GrantRequest, authMessage?: string): Promise<void>;
141
141
  queryViewOnlyEvmHexAddress(): Promise<void>;
142
142
  private refreshJwtToken;
@@ -144,40 +144,40 @@ export declare class CarbonWallet {
144
144
  private constructGrantRequest;
145
145
  setGrantee(grantee?: Grantee): void;
146
146
  isGranteeValid(): boolean;
147
- updateNetwork(network: Network): CarbonWallet;
147
+ updateNetwork(network: Network): OrbixWallet;
148
148
  setAuthorizedMsgs(msgs?: string[]): void;
149
- getSignedTx(signerAddress: string, messages: readonly EncodeObject[], sequence: number, opts: Omit<CarbonTx.SignTxOpts, "sequence">, granterAddress?: string): Promise<CarbonWallet.TxRaw>;
149
+ getSignedTx(signerAddress: string, messages: readonly EncodeObject[], sequence: number, opts: Omit<OrbixTx.SignTxOpts, "sequence">, granterAddress?: string): Promise<OrbixWallet.TxRaw>;
150
150
  /**
151
151
  * broadcast TX and wait for block confirmation
152
152
  *
153
153
  */
154
- broadcastTx(txRaw: CarbonWallet.TxRaw, opts?: CarbonTx.BroadcastTxOpts): Promise<CarbonWallet.SendTxResponse>;
154
+ broadcastTx(txRaw: OrbixWallet.TxRaw, opts?: OrbixTx.BroadcastTxOpts): Promise<OrbixWallet.SendTxResponse>;
155
155
  /**
156
156
  * broadcast TX to mempool but doesnt wait for block confirmation
157
157
  *
158
158
  */
159
- broadcastTxToMempoolWithoutConfirm(txRaw: CarbonWallet.TxRaw): Promise<CarbonWallet.SendTxToMempoolWithoutConfirmResponse>;
159
+ broadcastTxToMempoolWithoutConfirm(txRaw: OrbixWallet.TxRaw): Promise<OrbixWallet.SendTxToMempoolWithoutConfirmResponse>;
160
160
  /**
161
161
  * broadcast TX but doesnt wait for block confirmation nor submission to mempool
162
162
  *
163
163
  */
164
- broadcastTxWithoutConfirm(txRaw: CarbonWallet.TxRaw): Promise<CarbonWallet.SendTxWithoutConfirmResponse>;
165
- signAndBroadcast(messages: EncodeObject[], signOpts?: CarbonTx.SignTxOpts, broadcastOpts?: CarbonTx.BroadcastTxOpts): Promise<DeliverTxResponse | BroadcastTxSyncResponse | BroadcastTxAsyncResponse>;
164
+ broadcastTxWithoutConfirm(txRaw: OrbixWallet.TxRaw): Promise<OrbixWallet.SendTxWithoutConfirmResponse>;
165
+ signAndBroadcast(messages: EncodeObject[], signOpts?: OrbixTx.SignTxOpts, broadcastOpts?: OrbixTx.BroadcastTxOpts): Promise<DeliverTxResponse | BroadcastTxSyncResponse | BroadcastTxAsyncResponse>;
166
166
  private signTx;
167
167
  private signWithGrantee;
168
168
  private getBroadcastFunc;
169
169
  private dispatchTx;
170
- sendTxs(msgs: EncodeObject[], opts?: CarbonTx.SignTxOpts): Promise<CarbonWallet.SendTxResponse>;
171
- sendInitialMergeAccountTx(msgs: EncodeObject[], opts?: CarbonTx.SignTxOpts): Promise<void>;
172
- sendTxsWithoutConfirm(msgs: EncodeObject[], opts?: CarbonTx.SignTxOpts): Promise<CarbonWallet.SendTxToMempoolWithoutConfirmResponse>;
173
- sendTx(msg: EncodeObject, opts?: CarbonTx.SignTxOpts): Promise<CarbonWallet.SendTxResponse>;
170
+ sendTxs(msgs: EncodeObject[], opts?: OrbixTx.SignTxOpts): Promise<OrbixWallet.SendTxResponse>;
171
+ sendInitialMergeAccountTx(msgs: EncodeObject[], opts?: OrbixTx.SignTxOpts): Promise<void>;
172
+ sendTxsWithoutConfirm(msgs: EncodeObject[], opts?: OrbixTx.SignTxOpts): Promise<OrbixWallet.SendTxToMempoolWithoutConfirmResponse>;
173
+ sendTx(msg: EncodeObject, opts?: OrbixTx.SignTxOpts): Promise<OrbixWallet.SendTxResponse>;
174
174
  waitForTx(txHash: string, throwIfNotIncludedInBlock?: boolean, timeoutMs?: number, pollIntervalMs?: number): Promise<TxResponse>;
175
- getSigningClient(): Promise<CarbonSigningClient>;
175
+ getSigningClient(): Promise<OrbixSigningClient>;
176
176
  getTimeoutHeight(): Promise<number | undefined>;
177
177
  getTmClient(reconnect?: boolean): Promise<Tendermint37Client>;
178
178
  getChainId(): string;
179
179
  getEvmChainId(): string;
180
- isSigner(signerType: CarbonSignerTypes): boolean;
180
+ isSigner(signerType: OrbixSignerTypes): boolean;
181
181
  isLedgerSigner(): boolean;
182
182
  isLedgerViaBrowserExtension(): boolean;
183
183
  isPrivateKeySigner(): boolean;
@@ -203,7 +203,7 @@ export declare class CarbonWallet {
203
203
  private isNonceMismatchError;
204
204
  private getQueryClient;
205
205
  }
206
- export declare namespace CarbonWallet {
206
+ export declare namespace OrbixWallet {
207
207
  type SendTxResponse = DeliverTxResponse | BroadcastTxSyncResponse | BroadcastTxAsyncResponse;
208
208
  type SendTxToMempoolWithoutConfirmResponse = BroadcastTxSyncResponse;
209
209
  type SendTxWithoutConfirmResponse = BroadcastTxAsyncResponse;