@burningflames/inj-exchange-sdk 0.0.0-stage → 0.1.1

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 (70) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +7 -0
  3. package/README.md +228 -2
  4. package/dist/ApiManager-BcwRSg4p.cjs +14 -0
  5. package/dist/ApiManager-VsZ_7GMj.js +9 -0
  6. package/dist/MsgIncreasePositionMargin-7_g04vle.d.ts +2285 -0
  7. package/dist/MsgIncreasePositionMargin-UQn6vCje.d.cts +2284 -0
  8. package/dist/bank-c5iv-fbg.cjs +480 -0
  9. package/dist/bank-xWl_W05K.js +451 -0
  10. package/dist/chain-CgjV0b1c.js +5868 -0
  11. package/dist/chain-LTb0TjXc.cjs +5903 -0
  12. package/dist/clients/chain.cjs +8 -0
  13. package/dist/clients/chain.d.cts +2 -0
  14. package/dist/clients/chain.d.ts +2 -0
  15. package/dist/clients/chain.js +1 -0
  16. package/dist/clients/indexer.cjs +14 -0
  17. package/dist/clients/indexer.d.cts +2 -0
  18. package/dist/clients/indexer.d.ts +2 -0
  19. package/dist/clients/indexer.js +1 -0
  20. package/dist/coin-8_Vn0T8-.cjs +73 -0
  21. package/dist/coin-CowdNxVV.js +68 -0
  22. package/dist/decimal-CIFXn110.js +27 -0
  23. package/dist/decimal-DJMaLHQO.cjs +38 -0
  24. package/dist/eip712-88KVCEnw.d.cts +21 -0
  25. package/dist/eip712-88KVCEnw.d.ts +21 -0
  26. package/dist/errors-CKG7zTvs.cjs +36 -0
  27. package/dist/errors-MWG_E5zA.js +25 -0
  28. package/dist/exchange-BPRx-kFI.js +4637 -0
  29. package/dist/exchange-CTLbPuA7.cjs +4966 -0
  30. package/dist/index-B3bDzB4S.d.cts +2169 -0
  31. package/dist/index-BHLUinQA.d.ts +220 -0
  32. package/dist/index-BPpDV6JA.d.cts +182 -0
  33. package/dist/index-BT_zyZW9.d.cts +220 -0
  34. package/dist/index-DcQT-y4U.d.ts +2169 -0
  35. package/dist/index-DfoLUPEo.d.ts +183 -0
  36. package/dist/index.cjs +73 -0
  37. package/dist/index.d.cts +11 -0
  38. package/dist/index.d.ts +11 -0
  39. package/dist/index.js +13 -0
  40. package/dist/indexer-D7XfYsAZ.js +21699 -0
  41. package/dist/indexer-DI7-gHOA.cjs +21770 -0
  42. package/dist/msgs-Bi5b52-R.js +11359 -0
  43. package/dist/msgs-DNyc0UtV.cjs +11442 -0
  44. package/dist/msgs.cjs +16 -0
  45. package/dist/msgs.d.cts +2 -0
  46. package/dist/msgs.d.ts +2 -0
  47. package/dist/msgs.js +1 -0
  48. package/dist/query-DGTA8Lz_.js +13375 -0
  49. package/dist/query-L1m6tP9I.cjs +13530 -0
  50. package/dist/stream-BgKRWG60.d.cts +46 -0
  51. package/dist/stream-BgKRWG60.d.ts +46 -0
  52. package/dist/stream-D8ZvUQFy.cjs +29 -0
  53. package/dist/stream-RhVNTED5.js +18 -0
  54. package/dist/tendermint-CF_W9U6D.d.ts +49 -0
  55. package/dist/tendermint-zj8c-dVM.d.cts +49 -0
  56. package/dist/tx-BRaw1C6e.d.ts +66 -0
  57. package/dist/tx-BgpasOOk.cjs +464 -0
  58. package/dist/tx-CCt0zqng.d.cts +66 -0
  59. package/dist/tx-COcDYlg3.js +411 -0
  60. package/dist/tx-DIg8nbnn.cjs +1091 -0
  61. package/dist/tx-GN0SFql2.js +1026 -0
  62. package/dist/types.cjs +38 -0
  63. package/dist/types.d.cts +13 -0
  64. package/dist/types.d.ts +13 -0
  65. package/dist/types.js +26 -0
  66. package/dist/utils.cjs +131 -0
  67. package/dist/utils.d.cts +2 -0
  68. package/dist/utils.d.ts +2 -0
  69. package/dist/utils.js +115 -0
  70. package/package.json +125 -4
@@ -0,0 +1,8 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_chain = require("../chain-LTb0TjXc.cjs");
3
+ exports.ChainAuthApiClient = require_chain.ChainAuthApiClient;
4
+ exports.ChainAuthZApiClient = require_chain.ChainAuthZApiClient;
5
+ exports.ChainBankApiClient = require_chain.ChainBankApiClient;
6
+ exports.ChainExchangeApiClient = require_chain.ChainExchangeApiClient;
7
+ exports.ChainTendermintApiClient = require_chain.ChainTendermintApiClient;
8
+ exports.ChainTxApiClient = require_chain.ChainTxApiClient;
@@ -0,0 +1,2 @@
1
+ import { a as ChainAuthZApiClient, i as ChainBankApiClient, n as ChainTendermintApiClient, o as ChainAuthApiClient, r as ChainExchangeApiClient, t as ChainTxApiClient } from "../index-BT_zyZW9.cjs";
2
+ export { ChainAuthApiClient, ChainAuthZApiClient, ChainBankApiClient, ChainExchangeApiClient, ChainTendermintApiClient, ChainTxApiClient };
@@ -0,0 +1,2 @@
1
+ import { a as ChainAuthZApiClient, i as ChainBankApiClient, n as ChainTendermintApiClient, o as ChainAuthApiClient, r as ChainExchangeApiClient, t as ChainTxApiClient } from "../index-BHLUinQA.js";
2
+ export { ChainAuthApiClient, ChainAuthZApiClient, ChainBankApiClient, ChainExchangeApiClient, ChainTendermintApiClient, ChainTxApiClient };
@@ -0,0 +1 @@
1
+ export { o as ChainAuthApiClient, a as ChainAuthZApiClient, i as ChainBankApiClient, r as ChainExchangeApiClient, n as ChainTendermintApiClient, t as ChainTxApiClient } from "../chain-CgjV0b1c.js";
@@ -0,0 +1,14 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_indexer = require("../indexer-DI7-gHOA.cjs");
3
+ exports.IndexerAccountsApiClient = require_indexer.IndexerAccountsApiClient;
4
+ exports.IndexerAccountsStreamClient = require_indexer.IndexerAccountsStreamClient;
5
+ exports.IndexerArchiverApiClient = require_indexer.IndexerArchiverApiClient;
6
+ exports.IndexerDerivativesApiClient = require_indexer.IndexerDerivativesApiClient;
7
+ exports.IndexerDerivativesStreamClient = require_indexer.IndexerDerivativesStreamClient;
8
+ exports.IndexerOracleApiClient = require_indexer.IndexerOracleApiClient;
9
+ exports.IndexerOracleStreamClient = require_indexer.IndexerOracleStreamClient;
10
+ exports.IndexerPortfolioApiClient = require_indexer.IndexerPortfolioApiClient;
11
+ exports.IndexerPortfolioStreamClient = require_indexer.IndexerPortfolioStreamClient;
12
+ exports.IndexerSpotApiClient = require_indexer.IndexerSpotApiClient;
13
+ exports.IndexerSpotStreamClient = require_indexer.IndexerSpotStreamClient;
14
+ exports.StreamManager = require_indexer.StreamManager;
@@ -0,0 +1,2 @@
1
+ import { a as IndexerAccountsStreamClient, c as IndexerPortfolioApiClient, d as IndexerArchiverApiClient, f as IndexerAccountsApiClient, i as IndexerDerivativesStreamClient, l as IndexerOracleApiClient, n as IndexerPortfolioStreamClient, o as StreamManager, r as IndexerOracleStreamClient, s as IndexerSpotApiClient, t as IndexerSpotStreamClient, u as IndexerDerivativesApiClient } from "../index-B3bDzB4S.cjs";
2
+ export { IndexerAccountsApiClient, IndexerAccountsStreamClient, IndexerArchiverApiClient, IndexerDerivativesApiClient, IndexerDerivativesStreamClient, IndexerOracleApiClient, IndexerOracleStreamClient, IndexerPortfolioApiClient, IndexerPortfolioStreamClient, IndexerSpotApiClient, IndexerSpotStreamClient, StreamManager };
@@ -0,0 +1,2 @@
1
+ import { a as IndexerAccountsStreamClient, c as IndexerPortfolioApiClient, d as IndexerArchiverApiClient, f as IndexerAccountsApiClient, i as IndexerDerivativesStreamClient, l as IndexerOracleApiClient, n as IndexerPortfolioStreamClient, o as StreamManager, r as IndexerOracleStreamClient, s as IndexerSpotApiClient, t as IndexerSpotStreamClient, u as IndexerDerivativesApiClient } from "../index-DcQT-y4U.js";
2
+ export { IndexerAccountsApiClient, IndexerAccountsStreamClient, IndexerArchiverApiClient, IndexerDerivativesApiClient, IndexerDerivativesStreamClient, IndexerOracleApiClient, IndexerOracleStreamClient, IndexerPortfolioApiClient, IndexerPortfolioStreamClient, IndexerSpotApiClient, IndexerSpotStreamClient, StreamManager };
@@ -0,0 +1 @@
1
+ export { f as IndexerAccountsApiClient, a as IndexerAccountsStreamClient, d as IndexerArchiverApiClient, u as IndexerDerivativesApiClient, i as IndexerDerivativesStreamClient, l as IndexerOracleApiClient, r as IndexerOracleStreamClient, c as IndexerPortfolioApiClient, n as IndexerPortfolioStreamClient, s as IndexerSpotApiClient, t as IndexerSpotStreamClient, o as StreamManager } from "../indexer-D7XfYsAZ.js";
@@ -0,0 +1,73 @@
1
+ let _bufbuild_protobuf_wire = require("@bufbuild/protobuf/wire");
2
+ // gen/cosmos/base/v1beta1/coin.ts
3
+ function createBaseCoin() {
4
+ return {
5
+ denom: "",
6
+ amount: ""
7
+ };
8
+ }
9
+ const Coin = {
10
+ encode(message, writer = new _bufbuild_protobuf_wire.BinaryWriter()) {
11
+ if (message.denom !== "") writer.uint32(10).string(message.denom);
12
+ if (message.amount !== "") writer.uint32(18).string(message.amount);
13
+ return writer;
14
+ },
15
+ decode(input, length) {
16
+ const reader = input instanceof _bufbuild_protobuf_wire.BinaryReader ? input : new _bufbuild_protobuf_wire.BinaryReader(input);
17
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
18
+ if (previousRecursionDepth >= 100) throw new globalThis.Error("protobuf decode recursion limit exceeded");
19
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
20
+ try {
21
+ const end = length === void 0 ? reader.len : reader.pos + length;
22
+ const message = createBaseCoin();
23
+ while (reader.pos < end) {
24
+ const tag = reader.uint32();
25
+ switch (tag >>> 3) {
26
+ case 1:
27
+ if (tag !== 10) break;
28
+ message.denom = reader.string();
29
+ continue;
30
+ case 2:
31
+ if (tag !== 18) break;
32
+ message.amount = reader.string();
33
+ continue;
34
+ }
35
+ if ((tag & 7) === 4 || tag === 0) break;
36
+ reader.skip(tag & 7);
37
+ }
38
+ return message;
39
+ } finally {
40
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
41
+ }
42
+ },
43
+ fromJSON(object) {
44
+ return {
45
+ denom: isSet(object.denom) ? globalThis.String(object.denom) : "",
46
+ amount: isSet(object.amount) ? globalThis.String(object.amount) : ""
47
+ };
48
+ },
49
+ toJSON(message) {
50
+ const obj = {};
51
+ if (message.denom !== "") obj.denom = message.denom;
52
+ if (message.amount !== "") obj.amount = message.amount;
53
+ return obj;
54
+ },
55
+ create(base) {
56
+ return Coin.fromPartial(base ?? {});
57
+ },
58
+ fromPartial(object) {
59
+ const message = createBaseCoin();
60
+ message.denom = object.denom ?? "";
61
+ message.amount = object.amount ?? "";
62
+ return message;
63
+ }
64
+ };
65
+ function isSet(value) {
66
+ return value !== null && value !== void 0;
67
+ }
68
+ Object.defineProperty(exports, "Coin", {
69
+ enumerable: true,
70
+ get: function() {
71
+ return Coin;
72
+ }
73
+ });
@@ -0,0 +1,68 @@
1
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
2
+ // gen/cosmos/base/v1beta1/coin.ts
3
+ function createBaseCoin() {
4
+ return {
5
+ denom: "",
6
+ amount: ""
7
+ };
8
+ }
9
+ const Coin = {
10
+ encode(message, writer = new BinaryWriter()) {
11
+ if (message.denom !== "") writer.uint32(10).string(message.denom);
12
+ if (message.amount !== "") writer.uint32(18).string(message.amount);
13
+ return writer;
14
+ },
15
+ decode(input, length) {
16
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
17
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
18
+ if (previousRecursionDepth >= 100) throw new globalThis.Error("protobuf decode recursion limit exceeded");
19
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
20
+ try {
21
+ const end = length === void 0 ? reader.len : reader.pos + length;
22
+ const message = createBaseCoin();
23
+ while (reader.pos < end) {
24
+ const tag = reader.uint32();
25
+ switch (tag >>> 3) {
26
+ case 1:
27
+ if (tag !== 10) break;
28
+ message.denom = reader.string();
29
+ continue;
30
+ case 2:
31
+ if (tag !== 18) break;
32
+ message.amount = reader.string();
33
+ continue;
34
+ }
35
+ if ((tag & 7) === 4 || tag === 0) break;
36
+ reader.skip(tag & 7);
37
+ }
38
+ return message;
39
+ } finally {
40
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
41
+ }
42
+ },
43
+ fromJSON(object) {
44
+ return {
45
+ denom: isSet(object.denom) ? globalThis.String(object.denom) : "",
46
+ amount: isSet(object.amount) ? globalThis.String(object.amount) : ""
47
+ };
48
+ },
49
+ toJSON(message) {
50
+ const obj = {};
51
+ if (message.denom !== "") obj.denom = message.denom;
52
+ if (message.amount !== "") obj.amount = message.amount;
53
+ return obj;
54
+ },
55
+ create(base) {
56
+ return Coin.fromPartial(base ?? {});
57
+ },
58
+ fromPartial(object) {
59
+ const message = createBaseCoin();
60
+ message.denom = object.denom ?? "";
61
+ message.amount = object.amount ?? "";
62
+ return message;
63
+ }
64
+ };
65
+ function isSet(value) {
66
+ return value !== null && value !== void 0;
67
+ }
68
+ export { Coin as t };
@@ -0,0 +1,27 @@
1
+ // utils/decimal.ts
2
+ /**
3
+ * Chain format is the fixed-point string the chain stores: the human value
4
+ * shifted by 18 decimals, as a plain integer. "1.5" becomes
5
+ * "1500000000000000000".
6
+ */
7
+ function toChainFormat(value, decimals = 18) {
8
+ const text = typeof value === "number" ? value.toString() : value;
9
+ const negative = text.startsWith("-");
10
+ const [integer = "0", fraction = ""] = text.replace("-", "").split(".");
11
+ const digits = `${integer}${fraction.padEnd(decimals, "0").slice(0, decimals)}`.replace(/^0+(?=\d)/, "");
12
+ return `${negative ? "-" : ""}${digits}`;
13
+ }
14
+ /**
15
+ * The Cosmos SDK decimal string the EIP-712 payload signs: the same value as
16
+ * toChainFormat, but with the decimal point restored. "1.5" becomes
17
+ * "1.500000000000000000".
18
+ */
19
+ function toCosmosSdkDecString(value, decimals = 18) {
20
+ const chain = toChainFormat(value, decimals);
21
+ const negative = chain.startsWith("-");
22
+ const digits = chain.replace("-", "").padStart(decimals + 1, "0");
23
+ const integer = digits.slice(0, -decimals);
24
+ const fraction = digits.slice(-decimals);
25
+ return `${negative ? "-" : ""}${integer}.${fraction}`;
26
+ }
27
+ export { toCosmosSdkDecString as n, toChainFormat as t };
@@ -0,0 +1,38 @@
1
+ // utils/decimal.ts
2
+ /**
3
+ * Chain format is the fixed-point string the chain stores: the human value
4
+ * shifted by 18 decimals, as a plain integer. "1.5" becomes
5
+ * "1500000000000000000".
6
+ */
7
+ function toChainFormat(value, decimals = 18) {
8
+ const text = typeof value === "number" ? value.toString() : value;
9
+ const negative = text.startsWith("-");
10
+ const [integer = "0", fraction = ""] = text.replace("-", "").split(".");
11
+ const digits = `${integer}${fraction.padEnd(decimals, "0").slice(0, decimals)}`.replace(/^0+(?=\d)/, "");
12
+ return `${negative ? "-" : ""}${digits}`;
13
+ }
14
+ /**
15
+ * The Cosmos SDK decimal string the EIP-712 payload signs: the same value as
16
+ * toChainFormat, but with the decimal point restored. "1.5" becomes
17
+ * "1.500000000000000000".
18
+ */
19
+ function toCosmosSdkDecString(value, decimals = 18) {
20
+ const chain = toChainFormat(value, decimals);
21
+ const negative = chain.startsWith("-");
22
+ const digits = chain.replace("-", "").padStart(decimals + 1, "0");
23
+ const integer = digits.slice(0, -decimals);
24
+ const fraction = digits.slice(-decimals);
25
+ return `${negative ? "-" : ""}${integer}.${fraction}`;
26
+ }
27
+ Object.defineProperty(exports, "toChainFormat", {
28
+ enumerable: true,
29
+ get: function() {
30
+ return toChainFormat;
31
+ }
32
+ });
33
+ Object.defineProperty(exports, "toCosmosSdkDecString", {
34
+ enumerable: true,
35
+ get: function() {
36
+ return toCosmosSdkDecString;
37
+ }
38
+ });
@@ -0,0 +1,21 @@
1
+ interface Eip712TypedDataField {
2
+ name: string;
3
+ type: string;
4
+ }
5
+ interface Eip712TypedData {
6
+ types: Record<string, Eip712TypedDataField[]>;
7
+ primaryType: "Tx";
8
+ domain: {
9
+ name: string;
10
+ version: string;
11
+ chainId: string;
12
+ verifyingContract: string;
13
+ salt: string;
14
+ };
15
+ /** The transaction context, JSON encoded. */
16
+ message: {
17
+ context: string;
18
+ msgs: string;
19
+ };
20
+ }
21
+ export { Eip712TypedDataField as n, Eip712TypedData as t };
@@ -0,0 +1,21 @@
1
+ interface Eip712TypedDataField {
2
+ name: string;
3
+ type: string;
4
+ }
5
+ interface Eip712TypedData {
6
+ types: Record<string, Eip712TypedDataField[]>;
7
+ primaryType: "Tx";
8
+ domain: {
9
+ name: string;
10
+ version: string;
11
+ chainId: string;
12
+ verifyingContract: string;
13
+ salt: string;
14
+ };
15
+ /** The transaction context, JSON encoded. */
16
+ message: {
17
+ context: string;
18
+ msgs: string;
19
+ };
20
+ }
21
+ export { Eip712TypedDataField as n, Eip712TypedData as t };
@@ -0,0 +1,36 @@
1
+ // utils/helper.ts
2
+ function getServiceAndMethodFromPath(path) {
3
+ const spl = path.split("/");
4
+ return {
5
+ serviceName: spl[1] || "",
6
+ methodName: spl[2] || ""
7
+ };
8
+ }
9
+ // types/errors.ts
10
+ var ApiError = class ApiError extends Error {
11
+ code;
12
+ details;
13
+ serviceName;
14
+ methodName;
15
+ constructor(err, path) {
16
+ super(err.message);
17
+ this.code = err.code;
18
+ this.details = err.details;
19
+ const { serviceName, methodName } = getServiceAndMethodFromPath(path);
20
+ this.methodName = methodName;
21
+ this.serviceName = serviceName;
22
+ Object.setPrototypeOf(this, ApiError.prototype);
23
+ }
24
+ };
25
+ Object.defineProperty(exports, "ApiError", {
26
+ enumerable: true,
27
+ get: function() {
28
+ return ApiError;
29
+ }
30
+ });
31
+ Object.defineProperty(exports, "getServiceAndMethodFromPath", {
32
+ enumerable: true,
33
+ get: function() {
34
+ return getServiceAndMethodFromPath;
35
+ }
36
+ });
@@ -0,0 +1,25 @@
1
+ // utils/helper.ts
2
+ function getServiceAndMethodFromPath(path) {
3
+ const spl = path.split("/");
4
+ return {
5
+ serviceName: spl[1] || "",
6
+ methodName: spl[2] || ""
7
+ };
8
+ }
9
+ // types/errors.ts
10
+ var ApiError = class ApiError extends Error {
11
+ code;
12
+ details;
13
+ serviceName;
14
+ methodName;
15
+ constructor(err, path) {
16
+ super(err.message);
17
+ this.code = err.code;
18
+ this.details = err.details;
19
+ const { serviceName, methodName } = getServiceAndMethodFromPath(path);
20
+ this.methodName = methodName;
21
+ this.serviceName = serviceName;
22
+ Object.setPrototypeOf(this, ApiError.prototype);
23
+ }
24
+ };
25
+ export { getServiceAndMethodFromPath as n, ApiError as t };