@qorechain/sdk 0.6.0 → 0.6.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/dist/index.cjs CHANGED
@@ -11340,23 +11340,133 @@ async function withRetry2(fn, opts = {}) {
11340
11340
  }
11341
11341
  throw lastError;
11342
11342
  }
11343
- function toGoJson(ext) {
11344
- const obj = {
11345
- algorithm_id: ext.algorithm_id,
11346
- pqc_signature: base64(ext.pqc_signature)
11347
- };
11348
- if (ext.pqc_public_key !== void 0 && ext.pqc_public_key.length > 0) {
11349
- obj.pqc_public_key = base64(ext.pqc_public_key);
11343
+
11344
+ // src/codegen/qorechain/pqc/v1/hybrid.ts
11345
+ var hybrid_exports = {};
11346
+ __export(hybrid_exports, {
11347
+ PQCHybridSignature: () => PQCHybridSignature,
11348
+ protobufPackage: () => protobufPackage12
11349
+ });
11350
+ var protobufPackage12 = "qorechain.pqc.v1";
11351
+ function createBasePQCHybridSignature() {
11352
+ return { algorithmId: 0, pqcSignature: new Uint8Array(0), pqcPublicKey: new Uint8Array(0) };
11353
+ }
11354
+ var PQCHybridSignature = {
11355
+ encode(message, writer = new wire.BinaryWriter()) {
11356
+ if (message.algorithmId !== 0) {
11357
+ writer.uint32(8).uint32(message.algorithmId);
11358
+ }
11359
+ if (message.pqcSignature.length !== 0) {
11360
+ writer.uint32(18).bytes(message.pqcSignature);
11361
+ }
11362
+ if (message.pqcPublicKey.length !== 0) {
11363
+ writer.uint32(26).bytes(message.pqcPublicKey);
11364
+ }
11365
+ return writer;
11366
+ },
11367
+ decode(input, length) {
11368
+ const reader = input instanceof wire.BinaryReader ? input : new wire.BinaryReader(input);
11369
+ const end = length === void 0 ? reader.len : reader.pos + length;
11370
+ const message = createBasePQCHybridSignature();
11371
+ while (reader.pos < end) {
11372
+ const tag = reader.uint32();
11373
+ switch (tag >>> 3) {
11374
+ case 1: {
11375
+ if (tag !== 8) {
11376
+ break;
11377
+ }
11378
+ message.algorithmId = reader.uint32();
11379
+ continue;
11380
+ }
11381
+ case 2: {
11382
+ if (tag !== 18) {
11383
+ break;
11384
+ }
11385
+ message.pqcSignature = reader.bytes();
11386
+ continue;
11387
+ }
11388
+ case 3: {
11389
+ if (tag !== 26) {
11390
+ break;
11391
+ }
11392
+ message.pqcPublicKey = reader.bytes();
11393
+ continue;
11394
+ }
11395
+ }
11396
+ if ((tag & 7) === 4 || tag === 0) {
11397
+ break;
11398
+ }
11399
+ reader.skip(tag & 7);
11400
+ }
11401
+ return message;
11402
+ },
11403
+ fromJSON(object) {
11404
+ return {
11405
+ algorithmId: isSet13(object.algorithmId) ? globalThis.Number(object.algorithmId) : isSet13(object.algorithm_id) ? globalThis.Number(object.algorithm_id) : 0,
11406
+ pqcSignature: isSet13(object.pqcSignature) ? bytesFromBase648(object.pqcSignature) : isSet13(object.pqc_signature) ? bytesFromBase648(object.pqc_signature) : new Uint8Array(0),
11407
+ pqcPublicKey: isSet13(object.pqcPublicKey) ? bytesFromBase648(object.pqcPublicKey) : isSet13(object.pqc_public_key) ? bytesFromBase648(object.pqc_public_key) : new Uint8Array(0)
11408
+ };
11409
+ },
11410
+ toJSON(message) {
11411
+ const obj = {};
11412
+ if (message.algorithmId !== 0) {
11413
+ obj.algorithmId = Math.round(message.algorithmId);
11414
+ }
11415
+ if (message.pqcSignature.length !== 0) {
11416
+ obj.pqcSignature = base64FromBytes8(message.pqcSignature);
11417
+ }
11418
+ if (message.pqcPublicKey.length !== 0) {
11419
+ obj.pqcPublicKey = base64FromBytes8(message.pqcPublicKey);
11420
+ }
11421
+ return obj;
11422
+ },
11423
+ create(base) {
11424
+ return PQCHybridSignature.fromPartial(base ?? {});
11425
+ },
11426
+ fromPartial(object) {
11427
+ const message = createBasePQCHybridSignature();
11428
+ message.algorithmId = object.algorithmId ?? 0;
11429
+ message.pqcSignature = object.pqcSignature ?? new Uint8Array(0);
11430
+ message.pqcPublicKey = object.pqcPublicKey ?? new Uint8Array(0);
11431
+ return message;
11432
+ }
11433
+ };
11434
+ function bytesFromBase648(b64) {
11435
+ if (globalThis.Buffer) {
11436
+ return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
11437
+ } else {
11438
+ const bin = globalThis.atob(b64);
11439
+ const arr = new Uint8Array(bin.length);
11440
+ for (let i = 0; i < bin.length; ++i) {
11441
+ arr[i] = bin.charCodeAt(i);
11442
+ }
11443
+ return arr;
11350
11444
  }
11351
- return JSON.stringify(obj);
11352
11445
  }
11353
- function base64(bytes) {
11354
- let binary = "";
11355
- for (const b of bytes) binary += String.fromCharCode(b);
11356
- return btoa(binary);
11446
+ function base64FromBytes8(arr) {
11447
+ if (globalThis.Buffer) {
11448
+ return globalThis.Buffer.from(arr).toString("base64");
11449
+ } else {
11450
+ const bin = [];
11451
+ arr.forEach((byte) => {
11452
+ bin.push(globalThis.String.fromCharCode(byte));
11453
+ });
11454
+ return globalThis.btoa(bin.join(""));
11455
+ }
11456
+ }
11457
+ function isSet13(value) {
11458
+ return value !== null && value !== void 0;
11357
11459
  }
11460
+
11461
+ // src/tx/hybrid.ts
11358
11462
  function encodeHybridExtension(ext) {
11359
- const value = new TextEncoder().encode(toGoJson(ext));
11463
+ const value = PQCHybridSignature.encode(
11464
+ PQCHybridSignature.fromPartial({
11465
+ algorithmId: ext.algorithm_id,
11466
+ pqcSignature: ext.pqc_signature,
11467
+ pqcPublicKey: ext.pqc_public_key ?? new Uint8Array(0)
11468
+ })
11469
+ ).finish();
11360
11470
  return any.Any.fromPartial({ typeUrl: HYBRID_SIG_TYPE_URL, value });
11361
11471
  }
11362
11472
  function attachHybridExtension(body, ext, opts = {}) {
@@ -12122,123 +12232,6 @@ __export(codegen_exports, {
12122
12232
  svmQuery: () => query_exports13
12123
12233
  });
12124
12234
 
12125
- // src/codegen/qorechain/pqc/v1/hybrid.ts
12126
- var hybrid_exports = {};
12127
- __export(hybrid_exports, {
12128
- PQCHybridSignature: () => PQCHybridSignature,
12129
- protobufPackage: () => protobufPackage12
12130
- });
12131
- var protobufPackage12 = "qorechain.pqc.v1";
12132
- function createBasePQCHybridSignature() {
12133
- return { algorithmId: 0, pqcSignature: new Uint8Array(0), pqcPublicKey: new Uint8Array(0) };
12134
- }
12135
- var PQCHybridSignature = {
12136
- encode(message, writer = new wire.BinaryWriter()) {
12137
- if (message.algorithmId !== 0) {
12138
- writer.uint32(8).uint32(message.algorithmId);
12139
- }
12140
- if (message.pqcSignature.length !== 0) {
12141
- writer.uint32(18).bytes(message.pqcSignature);
12142
- }
12143
- if (message.pqcPublicKey.length !== 0) {
12144
- writer.uint32(26).bytes(message.pqcPublicKey);
12145
- }
12146
- return writer;
12147
- },
12148
- decode(input, length) {
12149
- const reader = input instanceof wire.BinaryReader ? input : new wire.BinaryReader(input);
12150
- const end = length === void 0 ? reader.len : reader.pos + length;
12151
- const message = createBasePQCHybridSignature();
12152
- while (reader.pos < end) {
12153
- const tag = reader.uint32();
12154
- switch (tag >>> 3) {
12155
- case 1: {
12156
- if (tag !== 8) {
12157
- break;
12158
- }
12159
- message.algorithmId = reader.uint32();
12160
- continue;
12161
- }
12162
- case 2: {
12163
- if (tag !== 18) {
12164
- break;
12165
- }
12166
- message.pqcSignature = reader.bytes();
12167
- continue;
12168
- }
12169
- case 3: {
12170
- if (tag !== 26) {
12171
- break;
12172
- }
12173
- message.pqcPublicKey = reader.bytes();
12174
- continue;
12175
- }
12176
- }
12177
- if ((tag & 7) === 4 || tag === 0) {
12178
- break;
12179
- }
12180
- reader.skip(tag & 7);
12181
- }
12182
- return message;
12183
- },
12184
- fromJSON(object) {
12185
- return {
12186
- algorithmId: isSet13(object.algorithmId) ? globalThis.Number(object.algorithmId) : isSet13(object.algorithm_id) ? globalThis.Number(object.algorithm_id) : 0,
12187
- pqcSignature: isSet13(object.pqcSignature) ? bytesFromBase648(object.pqcSignature) : isSet13(object.pqc_signature) ? bytesFromBase648(object.pqc_signature) : new Uint8Array(0),
12188
- pqcPublicKey: isSet13(object.pqcPublicKey) ? bytesFromBase648(object.pqcPublicKey) : isSet13(object.pqc_public_key) ? bytesFromBase648(object.pqc_public_key) : new Uint8Array(0)
12189
- };
12190
- },
12191
- toJSON(message) {
12192
- const obj = {};
12193
- if (message.algorithmId !== 0) {
12194
- obj.algorithmId = Math.round(message.algorithmId);
12195
- }
12196
- if (message.pqcSignature.length !== 0) {
12197
- obj.pqcSignature = base64FromBytes8(message.pqcSignature);
12198
- }
12199
- if (message.pqcPublicKey.length !== 0) {
12200
- obj.pqcPublicKey = base64FromBytes8(message.pqcPublicKey);
12201
- }
12202
- return obj;
12203
- },
12204
- create(base) {
12205
- return PQCHybridSignature.fromPartial(base ?? {});
12206
- },
12207
- fromPartial(object) {
12208
- const message = createBasePQCHybridSignature();
12209
- message.algorithmId = object.algorithmId ?? 0;
12210
- message.pqcSignature = object.pqcSignature ?? new Uint8Array(0);
12211
- message.pqcPublicKey = object.pqcPublicKey ?? new Uint8Array(0);
12212
- return message;
12213
- }
12214
- };
12215
- function bytesFromBase648(b64) {
12216
- if (globalThis.Buffer) {
12217
- return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
12218
- } else {
12219
- const bin = globalThis.atob(b64);
12220
- const arr = new Uint8Array(bin.length);
12221
- for (let i = 0; i < bin.length; ++i) {
12222
- arr[i] = bin.charCodeAt(i);
12223
- }
12224
- return arr;
12225
- }
12226
- }
12227
- function base64FromBytes8(arr) {
12228
- if (globalThis.Buffer) {
12229
- return globalThis.Buffer.from(arr).toString("base64");
12230
- } else {
12231
- const bin = [];
12232
- arr.forEach((byte) => {
12233
- bin.push(globalThis.String.fromCharCode(byte));
12234
- });
12235
- return globalThis.btoa(bin.join(""));
12236
- }
12237
- }
12238
- function isSet13(value) {
12239
- return value !== null && value !== void 0;
12240
- }
12241
-
12242
12235
  // src/codegen/qorechain/abstractaccount/v1/query.ts
12243
12236
  var query_exports = {};
12244
12237
  __export(query_exports, {
@@ -24830,7 +24823,7 @@ async function migrateToHybrid(tx, opts) {
24830
24823
  }
24831
24824
 
24832
24825
  // src/index.ts
24833
- var VERSION = "0.6.0";
24826
+ var VERSION = "0.6.1";
24834
24827
 
24835
24828
  Object.defineProperty(exports, "AI_ANOMALY_CHECK_ADDRESS", {
24836
24829
  enumerable: true,