@n1xyz/nord-ts 0.0.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.
- package/.eslintignore +1 -0
- package/.eslintrc.js +20 -0
- package/.prettierignore +1 -0
- package/README.md +110 -0
- package/dist/abis/ERC20_ABI.d.ts +39 -0
- package/dist/abis/ERC20_ABI.js +313 -0
- package/dist/abis/NORD_GETTERS_FACET_ABI.d.ts +34 -0
- package/dist/abis/NORD_GETTERS_FACET_ABI.js +195 -0
- package/dist/abis/NORD_RAMP_FACET_ABI.d.ts +35 -0
- package/dist/abis/NORD_RAMP_FACET_ABI.js +144 -0
- package/dist/abis/index.d.ts +3 -0
- package/dist/abis/index.js +9 -0
- package/dist/const.d.ts +11 -0
- package/dist/const.js +34 -0
- package/dist/gen/common.d.ts +63 -0
- package/dist/gen/common.js +205 -0
- package/dist/gen/nord.d.ts +705 -0
- package/dist/gen/nord.js +4784 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +21 -0
- package/dist/nord/Nord.d.ts +76 -0
- package/dist/nord/Nord.js +376 -0
- package/dist/nord/NordImpl.d.ts +7 -0
- package/dist/nord/NordImpl.js +6 -0
- package/dist/nord/NordUser.d.ts +77 -0
- package/dist/nord/NordUser.js +249 -0
- package/dist/nord/actions.d.ts +101 -0
- package/dist/nord/actions.js +254 -0
- package/dist/nord/index.d.ts +2 -0
- package/dist/nord/index.js +9 -0
- package/dist/types.d.ts +343 -0
- package/dist/types.js +92 -0
- package/dist/utils.d.ts +114 -0
- package/dist/utils.js +257 -0
- package/docs/.nojekyll +1 -0
- package/docs/assets/highlight.css +92 -0
- package/docs/assets/icons.js +15 -0
- package/docs/assets/icons.svg +1 -0
- package/docs/assets/main.js +59 -0
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1415 -0
- package/docs/classes/Nord.html +44 -0
- package/docs/classes/NordUser.html +35 -0
- package/docs/classes/Subscriber.html +6 -0
- package/docs/enums/FillMode.html +5 -0
- package/docs/enums/KeyType.html +4 -0
- package/docs/enums/PeakTpsPeriodUnit.html +15 -0
- package/docs/enums/Side.html +3 -0
- package/docs/functions/assert.html +1 -0
- package/docs/functions/bigIntToProtoU128.html +4 -0
- package/docs/functions/checkPubKeyLength.html +1 -0
- package/docs/functions/checkedFetch.html +6 -0
- package/docs/functions/createWebSocketSubscription.html +12 -0
- package/docs/functions/decodeLengthDelimited.html +10 -0
- package/docs/functions/encodeLengthDelimited.html +6 -0
- package/docs/functions/fillModeToProtoFillMode.html +5 -0
- package/docs/functions/findMarket.html +1 -0
- package/docs/functions/findToken.html +1 -0
- package/docs/functions/makeWalletSignFn.html +6 -0
- package/docs/functions/optExpect.html +5 -0
- package/docs/functions/optMap.html +5 -0
- package/docs/functions/optUnwrap.html +2 -0
- package/docs/functions/panic.html +1 -0
- package/docs/functions/signAction.html +6 -0
- package/docs/functions/toScaledU128.html +8 -0
- package/docs/functions/toScaledU64.html +8 -0
- package/docs/index.html +21 -0
- package/docs/interfaces/Account.html +8 -0
- package/docs/interfaces/ActionInfo.html +8 -0
- package/docs/interfaces/ActionQuery.html +4 -0
- package/docs/interfaces/ActionResponse.html +8 -0
- package/docs/interfaces/ActionsExtendedInfo.html +10 -0
- package/docs/interfaces/ActionsQuery.html +5 -0
- package/docs/interfaces/ActionsResponse.html +6 -0
- package/docs/interfaces/AggregateMetrics.html +12 -0
- package/docs/interfaces/BlockQuery.html +6 -0
- package/docs/interfaces/BlockResponse.html +6 -0
- package/docs/interfaces/BlockSummary.html +8 -0
- package/docs/interfaces/BlockSummaryResponse.html +6 -0
- package/docs/interfaces/DeltaEvent.html +6 -0
- package/docs/interfaces/ERC20TokenInfo.html +5 -0
- package/docs/interfaces/Info.html +3 -0
- package/docs/interfaces/Market.html +6 -0
- package/docs/interfaces/MarketStats.html +7 -0
- package/docs/interfaces/MarketsStatsResponse.html +2 -0
- package/docs/interfaces/NordConfig.html +5 -0
- package/docs/interfaces/Order.html +6 -0
- package/docs/interfaces/OrderInfo.html +6 -0
- package/docs/interfaces/OrderbookOrder.html +6 -0
- package/docs/interfaces/OrderbookResponse.html +10 -0
- package/docs/interfaces/PerpMarketStats.html +5 -0
- package/docs/interfaces/RollmanActionExtendedInfo.html +4 -0
- package/docs/interfaces/RollmanActionInfo.html +4 -0
- package/docs/interfaces/RollmanActionResponse.html +4 -0
- package/docs/interfaces/RollmanActionsResponse.html +2 -0
- package/docs/interfaces/RollmanBlockResponse.html +3 -0
- package/docs/interfaces/SubscriberConfig.html +3 -0
- package/docs/interfaces/Token.html +5 -0
- package/docs/interfaces/Trade.html +5 -0
- package/docs/interfaces/TradeInfo.html +20 -0
- package/docs/interfaces/Trades.html +5 -0
- package/docs/interfaces/TradesQueryParams.html +10 -0
- package/docs/interfaces/TradesResponse.html +12 -0
- package/docs/modules.html +77 -0
- package/docs/types/BigIntValue.html +2 -0
- package/docs/variables/DEBUG_KEYS.html +1 -0
- package/docs/variables/DEFAULT_FUNDING_AMOUNTS.html +1 -0
- package/docs/variables/DEV_CONTRACT_ADDRESS.html +1 -0
- package/docs/variables/DEV_TOKEN_INFOS.html +1 -0
- package/docs/variables/DEV_URL.html +1 -0
- package/docs/variables/ERC20_ABI.html +1 -0
- package/docs/variables/EVM_DEV_URL.html +1 -0
- package/docs/variables/FAUCET_PRIVATE_ADDRESS.html +1 -0
- package/docs/variables/MAX_BUFFER_LEN.html +1 -0
- package/docs/variables/NORD_GETTERS_FACET_ABI.html +1 -0
- package/docs/variables/NORD_RAMP_FACET_ABI.html +1 -0
- package/docs/variables/SESSION_TTL.html +1 -0
- package/docs/variables/WEBSERVER_DEV_URL.html +1 -0
- package/docs/variables/ZERO_DECIMAL.html +1 -0
- package/jest.config.ts +9 -0
- package/nodemon.json +4 -0
- package/package.json +61 -0
- package/protoc-generate.sh +23 -0
- package/src/abis/ERC20_ABI.ts +310 -0
- package/src/abis/NORD_GETTERS_FACET_ABI.ts +192 -0
- package/src/abis/NORD_RAMP_FACET_ABI.ts +141 -0
- package/src/abis/index.ts +3 -0
- package/src/const.ts +39 -0
- package/src/gen/common.ts +280 -0
- package/src/gen/nord.ts +5666 -0
- package/src/index.ts +5 -0
- package/src/nord/Nord.ts +504 -0
- package/src/nord/NordImpl.ts +8 -0
- package/src/nord/NordUser.ts +469 -0
- package/src/nord/actions.ts +484 -0
- package/src/nord/index.ts +2 -0
- package/src/types.ts +393 -0
- package/src/utils.ts +300 -0
- package/tests/utils.spec.ts +154 -0
- package/tsconfig.json +24 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
|
+
// versions:
|
|
4
|
+
// protoc-gen-ts_proto v2.2.0
|
|
5
|
+
// protoc v5.28.3
|
|
6
|
+
// source: common.proto
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.Message_Transfer = exports.Message = exports.protobufPackage = void 0;
|
|
9
|
+
/* eslint-disable */
|
|
10
|
+
const wire_1 = require("@bufbuild/protobuf/wire");
|
|
11
|
+
exports.protobufPackage = "common";
|
|
12
|
+
function createBaseMessage() {
|
|
13
|
+
return { kind: undefined };
|
|
14
|
+
}
|
|
15
|
+
exports.Message = {
|
|
16
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
17
|
+
switch (message.kind?.$case) {
|
|
18
|
+
case "transfer":
|
|
19
|
+
exports.Message_Transfer.encode(message.kind.value, writer.uint32(10).fork()).join();
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
return writer;
|
|
23
|
+
},
|
|
24
|
+
decode(input, length) {
|
|
25
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
26
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
27
|
+
const message = createBaseMessage();
|
|
28
|
+
while (reader.pos < end) {
|
|
29
|
+
const tag = reader.uint32();
|
|
30
|
+
switch (tag >>> 3) {
|
|
31
|
+
case 1:
|
|
32
|
+
if (tag !== 10) {
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
message.kind = { $case: "transfer", value: exports.Message_Transfer.decode(reader, reader.uint32()) };
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
reader.skip(tag & 7);
|
|
42
|
+
}
|
|
43
|
+
return message;
|
|
44
|
+
},
|
|
45
|
+
fromJSON(object) {
|
|
46
|
+
return {
|
|
47
|
+
kind: isSet(object.transfer)
|
|
48
|
+
? { $case: "transfer", value: exports.Message_Transfer.fromJSON(object.transfer) }
|
|
49
|
+
: undefined,
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
toJSON(message) {
|
|
53
|
+
const obj = {};
|
|
54
|
+
if (message.kind?.$case === "transfer") {
|
|
55
|
+
obj.transfer = exports.Message_Transfer.toJSON(message.kind.value);
|
|
56
|
+
}
|
|
57
|
+
return obj;
|
|
58
|
+
},
|
|
59
|
+
create(base) {
|
|
60
|
+
return exports.Message.fromPartial(base ?? {});
|
|
61
|
+
},
|
|
62
|
+
fromPartial(object) {
|
|
63
|
+
const message = createBaseMessage();
|
|
64
|
+
if (object.kind?.$case === "transfer" && object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
65
|
+
message.kind = { $case: "transfer", value: exports.Message_Transfer.fromPartial(object.kind.value) };
|
|
66
|
+
}
|
|
67
|
+
return message;
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
function createBaseMessage_Transfer() {
|
|
71
|
+
return { tokenId: 0, userPubkey: new Uint8Array(0), amount: 0n, channelId: [] };
|
|
72
|
+
}
|
|
73
|
+
exports.Message_Transfer = {
|
|
74
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
75
|
+
if (message.tokenId !== 0) {
|
|
76
|
+
writer.uint32(8).uint32(message.tokenId);
|
|
77
|
+
}
|
|
78
|
+
if (message.userPubkey.length !== 0) {
|
|
79
|
+
writer.uint32(18).bytes(message.userPubkey);
|
|
80
|
+
}
|
|
81
|
+
if (message.amount !== 0n) {
|
|
82
|
+
if (BigInt.asUintN(64, message.amount) !== message.amount) {
|
|
83
|
+
throw new globalThis.Error("value provided for field message.amount of type uint64 too large");
|
|
84
|
+
}
|
|
85
|
+
writer.uint32(24).uint64(message.amount);
|
|
86
|
+
}
|
|
87
|
+
writer.uint32(58).fork();
|
|
88
|
+
for (const v of message.channelId) {
|
|
89
|
+
writer.uint32(v);
|
|
90
|
+
}
|
|
91
|
+
writer.join();
|
|
92
|
+
return writer;
|
|
93
|
+
},
|
|
94
|
+
decode(input, length) {
|
|
95
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
96
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
97
|
+
const message = createBaseMessage_Transfer();
|
|
98
|
+
while (reader.pos < end) {
|
|
99
|
+
const tag = reader.uint32();
|
|
100
|
+
switch (tag >>> 3) {
|
|
101
|
+
case 1:
|
|
102
|
+
if (tag !== 8) {
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
message.tokenId = reader.uint32();
|
|
106
|
+
continue;
|
|
107
|
+
case 2:
|
|
108
|
+
if (tag !== 18) {
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
message.userPubkey = reader.bytes();
|
|
112
|
+
continue;
|
|
113
|
+
case 3:
|
|
114
|
+
if (tag !== 24) {
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
message.amount = reader.uint64();
|
|
118
|
+
continue;
|
|
119
|
+
case 7:
|
|
120
|
+
if (tag === 56) {
|
|
121
|
+
message.channelId.push(reader.uint32());
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
if (tag === 58) {
|
|
125
|
+
const end2 = reader.uint32() + reader.pos;
|
|
126
|
+
while (reader.pos < end2) {
|
|
127
|
+
message.channelId.push(reader.uint32());
|
|
128
|
+
}
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
reader.skip(tag & 7);
|
|
137
|
+
}
|
|
138
|
+
return message;
|
|
139
|
+
},
|
|
140
|
+
fromJSON(object) {
|
|
141
|
+
return {
|
|
142
|
+
tokenId: isSet(object.tokenId) ? globalThis.Number(object.tokenId) : 0,
|
|
143
|
+
userPubkey: isSet(object.userPubkey) ? bytesFromBase64(object.userPubkey) : new Uint8Array(0),
|
|
144
|
+
amount: isSet(object.amount) ? BigInt(object.amount) : 0n,
|
|
145
|
+
channelId: globalThis.Array.isArray(object?.channelId)
|
|
146
|
+
? object.channelId.map((e) => globalThis.Number(e))
|
|
147
|
+
: [],
|
|
148
|
+
};
|
|
149
|
+
},
|
|
150
|
+
toJSON(message) {
|
|
151
|
+
const obj = {};
|
|
152
|
+
if (message.tokenId !== 0) {
|
|
153
|
+
obj.tokenId = Math.round(message.tokenId);
|
|
154
|
+
}
|
|
155
|
+
if (message.userPubkey.length !== 0) {
|
|
156
|
+
obj.userPubkey = base64FromBytes(message.userPubkey);
|
|
157
|
+
}
|
|
158
|
+
if (message.amount !== 0n) {
|
|
159
|
+
obj.amount = message.amount.toString();
|
|
160
|
+
}
|
|
161
|
+
if (message.channelId?.length) {
|
|
162
|
+
obj.channelId = message.channelId.map((e) => Math.round(e));
|
|
163
|
+
}
|
|
164
|
+
return obj;
|
|
165
|
+
},
|
|
166
|
+
create(base) {
|
|
167
|
+
return exports.Message_Transfer.fromPartial(base ?? {});
|
|
168
|
+
},
|
|
169
|
+
fromPartial(object) {
|
|
170
|
+
const message = createBaseMessage_Transfer();
|
|
171
|
+
message.tokenId = object.tokenId ?? 0;
|
|
172
|
+
message.userPubkey = object.userPubkey ?? new Uint8Array(0);
|
|
173
|
+
message.amount = object.amount ?? 0n;
|
|
174
|
+
message.channelId = object.channelId?.map((e) => e) || [];
|
|
175
|
+
return message;
|
|
176
|
+
},
|
|
177
|
+
};
|
|
178
|
+
function bytesFromBase64(b64) {
|
|
179
|
+
if (globalThis.Buffer) {
|
|
180
|
+
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
const bin = globalThis.atob(b64);
|
|
184
|
+
const arr = new Uint8Array(bin.length);
|
|
185
|
+
for (let i = 0; i < bin.length; ++i) {
|
|
186
|
+
arr[i] = bin.charCodeAt(i);
|
|
187
|
+
}
|
|
188
|
+
return arr;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function base64FromBytes(arr) {
|
|
192
|
+
if (globalThis.Buffer) {
|
|
193
|
+
return globalThis.Buffer.from(arr).toString("base64");
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
const bin = [];
|
|
197
|
+
arr.forEach((byte) => {
|
|
198
|
+
bin.push(globalThis.String.fromCharCode(byte));
|
|
199
|
+
});
|
|
200
|
+
return globalThis.btoa(bin.join(""));
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
function isSet(value) {
|
|
204
|
+
return value !== null && value !== undefined;
|
|
205
|
+
}
|