carbon-js-sdk 0.3.36 → 0.3.37-dev.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.
@@ -3,13 +3,14 @@ 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.QueryClientImpl = exports.QueryAllBridgeResponse = exports.QueryAllBridgeRequest = exports.QueryGetBridgeResponse = exports.QueryGetBridgeRequest = exports.QueryTotalBalancesResponse = exports.QueryTotalBalancesRequest = exports.QueryGetBalancesResponse = exports.QueryGetBalancesRequest = exports.QueryAllWrapperMappingsResponse_WrapperMappingsEntry = exports.QueryAllWrapperMappingsResponse = exports.QueryAllWrapperMappingsRequest = exports.QueryGetLockedCoinsResponse = exports.QueryGetLockedCoinsRequest = exports.QueryAllTokenResponse = exports.QueryAllTokenRequest = exports.QueryGetTokenResponse = exports.QueryGetTokenRequest = exports.protobufPackage = void 0;
6
+ exports.QueryClientImpl = exports.QueryTokenGroupMappingsResponse_TokenGroupMappingsEntry = exports.QueryTokenGroupMappingsResponse = exports.QueryTokenGroupMappingsRequest = exports.QueryAllTokenGroupsResponse = exports.QueryAllTokenGroupsRequest = exports.QueryGetTokenGroupResponse = exports.QueryGetTokenGroupRequest = exports.QueryAllBridgeResponse = exports.QueryAllBridgeRequest = exports.QueryGetBridgeResponse = exports.QueryGetBridgeRequest = exports.QueryTotalBalancesResponse = exports.QueryTotalBalancesRequest = exports.QueryGetBalancesResponse = exports.QueryGetBalancesRequest = exports.QueryAllWrapperMappingsResponse_WrapperMappingsEntry = exports.QueryAllWrapperMappingsResponse = exports.QueryAllWrapperMappingsRequest = exports.QueryGetLockedCoinsResponse = exports.QueryGetLockedCoinsRequest = exports.QueryAllTokenResponse = exports.QueryAllTokenRequest = exports.QueryGetTokenResponse = exports.QueryGetTokenRequest = exports.protobufPackage = void 0;
7
7
  /* eslint-disable */
8
8
  const long_1 = __importDefault(require("long"));
9
9
  const minimal_1 = __importDefault(require("protobufjs/minimal"));
10
10
  const token_1 = require("./token");
11
11
  const pagination_1 = require("../cosmos/base/query/v1beta1/pagination");
12
12
  const bridge_1 = require("./bridge");
13
+ const group_1 = require("./group");
13
14
  exports.protobufPackage = "Switcheo.carbon.coin";
14
15
  const baseQueryGetTokenRequest = { denom: "" };
15
16
  exports.QueryGetTokenRequest = {
@@ -958,6 +959,408 @@ exports.QueryAllBridgeResponse = {
958
959
  return message;
959
960
  },
960
961
  };
962
+ const baseQueryGetTokenGroupRequest = { groupId: "" };
963
+ exports.QueryGetTokenGroupRequest = {
964
+ encode(message, writer = minimal_1.default.Writer.create()) {
965
+ if (message.groupId !== "") {
966
+ writer.uint32(10).string(message.groupId);
967
+ }
968
+ return writer;
969
+ },
970
+ decode(input, length) {
971
+ const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
972
+ let end = length === undefined ? reader.len : reader.pos + length;
973
+ const message = Object.assign({}, baseQueryGetTokenGroupRequest);
974
+ while (reader.pos < end) {
975
+ const tag = reader.uint32();
976
+ switch (tag >>> 3) {
977
+ case 1:
978
+ message.groupId = reader.string();
979
+ break;
980
+ default:
981
+ reader.skipType(tag & 7);
982
+ break;
983
+ }
984
+ }
985
+ return message;
986
+ },
987
+ fromJSON(object) {
988
+ const message = Object.assign({}, baseQueryGetTokenGroupRequest);
989
+ message.groupId =
990
+ object.groupId !== undefined && object.groupId !== null
991
+ ? String(object.groupId)
992
+ : "";
993
+ return message;
994
+ },
995
+ toJSON(message) {
996
+ const obj = {};
997
+ message.groupId !== undefined && (obj.groupId = message.groupId);
998
+ return obj;
999
+ },
1000
+ fromPartial(object) {
1001
+ var _a;
1002
+ const message = Object.assign({}, baseQueryGetTokenGroupRequest);
1003
+ message.groupId = (_a = object.groupId) !== null && _a !== void 0 ? _a : "";
1004
+ return message;
1005
+ },
1006
+ };
1007
+ const baseQueryGetTokenGroupResponse = {};
1008
+ exports.QueryGetTokenGroupResponse = {
1009
+ encode(message, writer = minimal_1.default.Writer.create()) {
1010
+ if (message.tokenGroup !== undefined) {
1011
+ group_1.TokenGroupDetails.encode(message.tokenGroup, writer.uint32(10).fork()).ldelim();
1012
+ }
1013
+ return writer;
1014
+ },
1015
+ decode(input, length) {
1016
+ const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
1017
+ let end = length === undefined ? reader.len : reader.pos + length;
1018
+ const message = Object.assign({}, baseQueryGetTokenGroupResponse);
1019
+ while (reader.pos < end) {
1020
+ const tag = reader.uint32();
1021
+ switch (tag >>> 3) {
1022
+ case 1:
1023
+ message.tokenGroup = group_1.TokenGroupDetails.decode(reader, reader.uint32());
1024
+ break;
1025
+ default:
1026
+ reader.skipType(tag & 7);
1027
+ break;
1028
+ }
1029
+ }
1030
+ return message;
1031
+ },
1032
+ fromJSON(object) {
1033
+ const message = Object.assign({}, baseQueryGetTokenGroupResponse);
1034
+ message.tokenGroup =
1035
+ object.tokenGroup !== undefined && object.tokenGroup !== null
1036
+ ? group_1.TokenGroupDetails.fromJSON(object.tokenGroup)
1037
+ : undefined;
1038
+ return message;
1039
+ },
1040
+ toJSON(message) {
1041
+ const obj = {};
1042
+ message.tokenGroup !== undefined &&
1043
+ (obj.tokenGroup = message.tokenGroup
1044
+ ? group_1.TokenGroupDetails.toJSON(message.tokenGroup)
1045
+ : undefined);
1046
+ return obj;
1047
+ },
1048
+ fromPartial(object) {
1049
+ const message = Object.assign({}, baseQueryGetTokenGroupResponse);
1050
+ message.tokenGroup =
1051
+ object.tokenGroup !== undefined && object.tokenGroup !== null
1052
+ ? group_1.TokenGroupDetails.fromPartial(object.tokenGroup)
1053
+ : undefined;
1054
+ return message;
1055
+ },
1056
+ };
1057
+ const baseQueryAllTokenGroupsRequest = {};
1058
+ exports.QueryAllTokenGroupsRequest = {
1059
+ encode(message, writer = minimal_1.default.Writer.create()) {
1060
+ if (message.pagination !== undefined) {
1061
+ pagination_1.PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim();
1062
+ }
1063
+ return writer;
1064
+ },
1065
+ decode(input, length) {
1066
+ const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
1067
+ let end = length === undefined ? reader.len : reader.pos + length;
1068
+ const message = Object.assign({}, baseQueryAllTokenGroupsRequest);
1069
+ while (reader.pos < end) {
1070
+ const tag = reader.uint32();
1071
+ switch (tag >>> 3) {
1072
+ case 1:
1073
+ message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32());
1074
+ break;
1075
+ default:
1076
+ reader.skipType(tag & 7);
1077
+ break;
1078
+ }
1079
+ }
1080
+ return message;
1081
+ },
1082
+ fromJSON(object) {
1083
+ const message = Object.assign({}, baseQueryAllTokenGroupsRequest);
1084
+ message.pagination =
1085
+ object.pagination !== undefined && object.pagination !== null
1086
+ ? pagination_1.PageRequest.fromJSON(object.pagination)
1087
+ : undefined;
1088
+ return message;
1089
+ },
1090
+ toJSON(message) {
1091
+ const obj = {};
1092
+ message.pagination !== undefined &&
1093
+ (obj.pagination = message.pagination
1094
+ ? pagination_1.PageRequest.toJSON(message.pagination)
1095
+ : undefined);
1096
+ return obj;
1097
+ },
1098
+ fromPartial(object) {
1099
+ const message = Object.assign({}, baseQueryAllTokenGroupsRequest);
1100
+ message.pagination =
1101
+ object.pagination !== undefined && object.pagination !== null
1102
+ ? pagination_1.PageRequest.fromPartial(object.pagination)
1103
+ : undefined;
1104
+ return message;
1105
+ },
1106
+ };
1107
+ const baseQueryAllTokenGroupsResponse = {};
1108
+ exports.QueryAllTokenGroupsResponse = {
1109
+ encode(message, writer = minimal_1.default.Writer.create()) {
1110
+ for (const v of message.tokenGroups) {
1111
+ group_1.TokenGroupDetails.encode(v, writer.uint32(10).fork()).ldelim();
1112
+ }
1113
+ if (message.pagination !== undefined) {
1114
+ pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim();
1115
+ }
1116
+ return writer;
1117
+ },
1118
+ decode(input, length) {
1119
+ const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
1120
+ let end = length === undefined ? reader.len : reader.pos + length;
1121
+ const message = Object.assign({}, baseQueryAllTokenGroupsResponse);
1122
+ message.tokenGroups = [];
1123
+ while (reader.pos < end) {
1124
+ const tag = reader.uint32();
1125
+ switch (tag >>> 3) {
1126
+ case 1:
1127
+ message.tokenGroups.push(group_1.TokenGroupDetails.decode(reader, reader.uint32()));
1128
+ break;
1129
+ case 2:
1130
+ message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32());
1131
+ break;
1132
+ default:
1133
+ reader.skipType(tag & 7);
1134
+ break;
1135
+ }
1136
+ }
1137
+ return message;
1138
+ },
1139
+ fromJSON(object) {
1140
+ var _a;
1141
+ const message = Object.assign({}, baseQueryAllTokenGroupsResponse);
1142
+ message.tokenGroups = ((_a = object.tokenGroups) !== null && _a !== void 0 ? _a : []).map((e) => group_1.TokenGroupDetails.fromJSON(e));
1143
+ message.pagination =
1144
+ object.pagination !== undefined && object.pagination !== null
1145
+ ? pagination_1.PageResponse.fromJSON(object.pagination)
1146
+ : undefined;
1147
+ return message;
1148
+ },
1149
+ toJSON(message) {
1150
+ const obj = {};
1151
+ if (message.tokenGroups) {
1152
+ obj.tokenGroups = message.tokenGroups.map((e) => e ? group_1.TokenGroupDetails.toJSON(e) : undefined);
1153
+ }
1154
+ else {
1155
+ obj.tokenGroups = [];
1156
+ }
1157
+ message.pagination !== undefined &&
1158
+ (obj.pagination = message.pagination
1159
+ ? pagination_1.PageResponse.toJSON(message.pagination)
1160
+ : undefined);
1161
+ return obj;
1162
+ },
1163
+ fromPartial(object) {
1164
+ var _a;
1165
+ const message = Object.assign({}, baseQueryAllTokenGroupsResponse);
1166
+ message.tokenGroups = ((_a = object.tokenGroups) !== null && _a !== void 0 ? _a : []).map((e) => group_1.TokenGroupDetails.fromPartial(e));
1167
+ message.pagination =
1168
+ object.pagination !== undefined && object.pagination !== null
1169
+ ? pagination_1.PageResponse.fromPartial(object.pagination)
1170
+ : undefined;
1171
+ return message;
1172
+ },
1173
+ };
1174
+ const baseQueryTokenGroupMappingsRequest = {};
1175
+ exports.QueryTokenGroupMappingsRequest = {
1176
+ encode(message, writer = minimal_1.default.Writer.create()) {
1177
+ if (message.pagination !== undefined) {
1178
+ pagination_1.PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim();
1179
+ }
1180
+ return writer;
1181
+ },
1182
+ decode(input, length) {
1183
+ const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
1184
+ let end = length === undefined ? reader.len : reader.pos + length;
1185
+ const message = Object.assign({}, baseQueryTokenGroupMappingsRequest);
1186
+ while (reader.pos < end) {
1187
+ const tag = reader.uint32();
1188
+ switch (tag >>> 3) {
1189
+ case 1:
1190
+ message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32());
1191
+ break;
1192
+ default:
1193
+ reader.skipType(tag & 7);
1194
+ break;
1195
+ }
1196
+ }
1197
+ return message;
1198
+ },
1199
+ fromJSON(object) {
1200
+ const message = Object.assign({}, baseQueryTokenGroupMappingsRequest);
1201
+ message.pagination =
1202
+ object.pagination !== undefined && object.pagination !== null
1203
+ ? pagination_1.PageRequest.fromJSON(object.pagination)
1204
+ : undefined;
1205
+ return message;
1206
+ },
1207
+ toJSON(message) {
1208
+ const obj = {};
1209
+ message.pagination !== undefined &&
1210
+ (obj.pagination = message.pagination
1211
+ ? pagination_1.PageRequest.toJSON(message.pagination)
1212
+ : undefined);
1213
+ return obj;
1214
+ },
1215
+ fromPartial(object) {
1216
+ const message = Object.assign({}, baseQueryTokenGroupMappingsRequest);
1217
+ message.pagination =
1218
+ object.pagination !== undefined && object.pagination !== null
1219
+ ? pagination_1.PageRequest.fromPartial(object.pagination)
1220
+ : undefined;
1221
+ return message;
1222
+ },
1223
+ };
1224
+ const baseQueryTokenGroupMappingsResponse = {};
1225
+ exports.QueryTokenGroupMappingsResponse = {
1226
+ encode(message, writer = minimal_1.default.Writer.create()) {
1227
+ Object.entries(message.tokenGroupMappings).forEach(([key, value]) => {
1228
+ exports.QueryTokenGroupMappingsResponse_TokenGroupMappingsEntry.encode({ key: key, value }, writer.uint32(10).fork()).ldelim();
1229
+ });
1230
+ if (message.pagination !== undefined) {
1231
+ pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim();
1232
+ }
1233
+ return writer;
1234
+ },
1235
+ decode(input, length) {
1236
+ const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
1237
+ let end = length === undefined ? reader.len : reader.pos + length;
1238
+ const message = Object.assign({}, baseQueryTokenGroupMappingsResponse);
1239
+ message.tokenGroupMappings = {};
1240
+ while (reader.pos < end) {
1241
+ const tag = reader.uint32();
1242
+ switch (tag >>> 3) {
1243
+ case 1:
1244
+ const entry1 = exports.QueryTokenGroupMappingsResponse_TokenGroupMappingsEntry.decode(reader, reader.uint32());
1245
+ if (entry1.value !== undefined) {
1246
+ message.tokenGroupMappings[entry1.key] = entry1.value;
1247
+ }
1248
+ break;
1249
+ case 2:
1250
+ message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32());
1251
+ break;
1252
+ default:
1253
+ reader.skipType(tag & 7);
1254
+ break;
1255
+ }
1256
+ }
1257
+ return message;
1258
+ },
1259
+ fromJSON(object) {
1260
+ var _a;
1261
+ const message = Object.assign({}, baseQueryTokenGroupMappingsResponse);
1262
+ message.tokenGroupMappings = Object.entries((_a = object.tokenGroupMappings) !== null && _a !== void 0 ? _a : {}).reduce((acc, [key, value]) => {
1263
+ acc[key] = long_1.default.fromString(value);
1264
+ return acc;
1265
+ }, {});
1266
+ message.pagination =
1267
+ object.pagination !== undefined && object.pagination !== null
1268
+ ? pagination_1.PageResponse.fromJSON(object.pagination)
1269
+ : undefined;
1270
+ return message;
1271
+ },
1272
+ toJSON(message) {
1273
+ const obj = {};
1274
+ obj.tokenGroupMappings = {};
1275
+ if (message.tokenGroupMappings) {
1276
+ Object.entries(message.tokenGroupMappings).forEach(([k, v]) => {
1277
+ obj.tokenGroupMappings[k] = v.toString();
1278
+ });
1279
+ }
1280
+ message.pagination !== undefined &&
1281
+ (obj.pagination = message.pagination
1282
+ ? pagination_1.PageResponse.toJSON(message.pagination)
1283
+ : undefined);
1284
+ return obj;
1285
+ },
1286
+ fromPartial(object) {
1287
+ var _a;
1288
+ const message = Object.assign({}, baseQueryTokenGroupMappingsResponse);
1289
+ message.tokenGroupMappings = Object.entries((_a = object.tokenGroupMappings) !== null && _a !== void 0 ? _a : {}).reduce((acc, [key, value]) => {
1290
+ if (value !== undefined) {
1291
+ acc[key] = long_1.default.fromValue(value);
1292
+ }
1293
+ return acc;
1294
+ }, {});
1295
+ message.pagination =
1296
+ object.pagination !== undefined && object.pagination !== null
1297
+ ? pagination_1.PageResponse.fromPartial(object.pagination)
1298
+ : undefined;
1299
+ return message;
1300
+ },
1301
+ };
1302
+ const baseQueryTokenGroupMappingsResponse_TokenGroupMappingsEntry = {
1303
+ key: "",
1304
+ value: long_1.default.UZERO,
1305
+ };
1306
+ exports.QueryTokenGroupMappingsResponse_TokenGroupMappingsEntry = {
1307
+ encode(message, writer = minimal_1.default.Writer.create()) {
1308
+ if (message.key !== "") {
1309
+ writer.uint32(10).string(message.key);
1310
+ }
1311
+ if (!message.value.isZero()) {
1312
+ writer.uint32(16).uint64(message.value);
1313
+ }
1314
+ return writer;
1315
+ },
1316
+ decode(input, length) {
1317
+ const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
1318
+ let end = length === undefined ? reader.len : reader.pos + length;
1319
+ const message = Object.assign({}, baseQueryTokenGroupMappingsResponse_TokenGroupMappingsEntry);
1320
+ while (reader.pos < end) {
1321
+ const tag = reader.uint32();
1322
+ switch (tag >>> 3) {
1323
+ case 1:
1324
+ message.key = reader.string();
1325
+ break;
1326
+ case 2:
1327
+ message.value = reader.uint64();
1328
+ break;
1329
+ default:
1330
+ reader.skipType(tag & 7);
1331
+ break;
1332
+ }
1333
+ }
1334
+ return message;
1335
+ },
1336
+ fromJSON(object) {
1337
+ const message = Object.assign({}, baseQueryTokenGroupMappingsResponse_TokenGroupMappingsEntry);
1338
+ message.key =
1339
+ object.key !== undefined && object.key !== null ? String(object.key) : "";
1340
+ message.value =
1341
+ object.value !== undefined && object.value !== null
1342
+ ? long_1.default.fromString(object.value)
1343
+ : long_1.default.UZERO;
1344
+ return message;
1345
+ },
1346
+ toJSON(message) {
1347
+ const obj = {};
1348
+ message.key !== undefined && (obj.key = message.key);
1349
+ message.value !== undefined &&
1350
+ (obj.value = (message.value || long_1.default.UZERO).toString());
1351
+ return obj;
1352
+ },
1353
+ fromPartial(object) {
1354
+ var _a;
1355
+ const message = Object.assign({}, baseQueryTokenGroupMappingsResponse_TokenGroupMappingsEntry);
1356
+ message.key = (_a = object.key) !== null && _a !== void 0 ? _a : "";
1357
+ message.value =
1358
+ object.value !== undefined && object.value !== null
1359
+ ? long_1.default.fromValue(object.value)
1360
+ : long_1.default.UZERO;
1361
+ return message;
1362
+ },
1363
+ };
961
1364
  class QueryClientImpl {
962
1365
  constructor(rpc) {
963
1366
  this.rpc = rpc;
@@ -969,6 +1372,9 @@ class QueryClientImpl {
969
1372
  this.BalancesTotal = this.BalancesTotal.bind(this);
970
1373
  this.Bridge = this.Bridge.bind(this);
971
1374
  this.BridgeAll = this.BridgeAll.bind(this);
1375
+ this.TokenGroup = this.TokenGroup.bind(this);
1376
+ this.TokenGroupAll = this.TokenGroupAll.bind(this);
1377
+ this.TokenGroupMappings = this.TokenGroupMappings.bind(this);
972
1378
  }
973
1379
  Token(request) {
974
1380
  const data = exports.QueryGetTokenRequest.encode(request).finish();
@@ -1010,6 +1416,21 @@ class QueryClientImpl {
1010
1416
  const promise = this.rpc.request("Switcheo.carbon.coin.Query", "BridgeAll", data);
1011
1417
  return promise.then((data) => exports.QueryAllBridgeResponse.decode(new minimal_1.default.Reader(data)));
1012
1418
  }
1419
+ TokenGroup(request) {
1420
+ const data = exports.QueryGetTokenGroupRequest.encode(request).finish();
1421
+ const promise = this.rpc.request("Switcheo.carbon.coin.Query", "TokenGroup", data);
1422
+ return promise.then((data) => exports.QueryGetTokenGroupResponse.decode(new minimal_1.default.Reader(data)));
1423
+ }
1424
+ TokenGroupAll(request) {
1425
+ const data = exports.QueryAllTokenGroupsRequest.encode(request).finish();
1426
+ const promise = this.rpc.request("Switcheo.carbon.coin.Query", "TokenGroupAll", data);
1427
+ return promise.then((data) => exports.QueryAllTokenGroupsResponse.decode(new minimal_1.default.Reader(data)));
1428
+ }
1429
+ TokenGroupMappings(request) {
1430
+ const data = exports.QueryTokenGroupMappingsRequest.encode(request).finish();
1431
+ const promise = this.rpc.request("Switcheo.carbon.coin.Query", "TokenGroupMappings", data);
1432
+ return promise.then((data) => exports.QueryTokenGroupMappingsResponse.decode(new minimal_1.default.Reader(data)));
1433
+ }
1013
1434
  }
1014
1435
  exports.QueryClientImpl = QueryClientImpl;
1015
1436
  if (minimal_1.default.util.Long !== long_1.default) {