@qorechain/sdk 0.6.1 → 0.7.0

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.js CHANGED
@@ -14,7 +14,7 @@ import { wordlist } from '@scure/bip39/wordlists/english';
14
14
  import { HDKey as HDKey$1 } from '@scure/bip32';
15
15
  import { HDKey } from 'micro-key-producer/slip10.js';
16
16
  import { secp256k1 } from '@noble/curves/secp256k1';
17
- import { mldsa87, shake256 } from '@qorechain/pqc';
17
+ import { mldsa87, shake256, mldsa } from '@qorechain/pqc';
18
18
  import { randomBytes } from '@noble/hashes/utils';
19
19
  export { AI_ANOMALY_CHECK_ADDRESS, AI_RISK_SCORE_ADDRESS, RISK_LEVEL_UNSAFE_THRESHOLD, ai, aiAnomalyCheck, aiRiskScore, simulateWithRiskScore } from '@qorechain/evm';
20
20
  import { connectComet } from '@cosmjs/tendermint-rpc';
@@ -276,6 +276,35 @@ var RestClient = class {
276
276
  getInflationRate() {
277
277
  return this.get("/qorechain/inflation/v1/rate");
278
278
  }
279
+ // --- Abstract-account authenticator lanes (v3.1.85) ----------------------
280
+ /**
281
+ * The canonical authenticator permission taxonomy
282
+ * (`/qorechain/abstractaccount/v1/permission_schema`): the valid permission
283
+ * strings, the message-typeURL→permission mapping, the never-delegable
284
+ * key-management typeURLs, and a `schema_version` for drift detection.
285
+ */
286
+ getPermissionSchema() {
287
+ return this.get(
288
+ "/qorechain/abstractaccount/v1/permission_schema"
289
+ );
290
+ }
291
+ /** Abstract-account module config (`/qorechain/abstractaccount/v1/config`). */
292
+ getAbstractAccountConfig() {
293
+ return this.get("/qorechain/abstractaccount/v1/config");
294
+ }
295
+ /** All abstract accounts (`/qorechain/abstractaccount/v1/accounts`). */
296
+ getAbstractAccounts() {
297
+ return this.get("/qorechain/abstractaccount/v1/accounts");
298
+ }
299
+ /**
300
+ * A single abstract account by address
301
+ * (`/qorechain/abstractaccount/v1/accounts/{address}`).
302
+ */
303
+ getAbstractAccount(address) {
304
+ return this.get(
305
+ `/qorechain/abstractaccount/v1/accounts/${encodeURIComponent(address)}`
306
+ );
307
+ }
279
308
  };
280
309
 
281
310
  // src/query/jsonrpc.ts
@@ -5749,6 +5778,8 @@ __export(tx_exports5, {
5749
5778
  MsgRegisterPQCKeyResponse: () => MsgRegisterPQCKeyResponse,
5750
5779
  MsgRegisterPQCKeyV2: () => MsgRegisterPQCKeyV2,
5751
5780
  MsgRegisterPQCKeyV2Response: () => MsgRegisterPQCKeyV2Response,
5781
+ MsgRotatePQCKey: () => MsgRotatePQCKey,
5782
+ MsgRotatePQCKeyResponse: () => MsgRotatePQCKeyResponse,
5752
5783
  protobufPackage: () => protobufPackage5
5753
5784
  });
5754
5785
  var protobufPackage5 = "qorechain.pqc.v1";
@@ -6203,6 +6234,160 @@ var MsgMigratePQCKeyResponse = {
6203
6234
  return message;
6204
6235
  }
6205
6236
  };
6237
+ function createBaseMsgRotatePQCKey() {
6238
+ return {
6239
+ sender: "",
6240
+ oldPublicKey: new Uint8Array(0),
6241
+ newPublicKey: new Uint8Array(0),
6242
+ oldSignature: new Uint8Array(0),
6243
+ newSignature: new Uint8Array(0)
6244
+ };
6245
+ }
6246
+ var MsgRotatePQCKey = {
6247
+ encode(message, writer = new BinaryWriter()) {
6248
+ if (message.sender !== "") {
6249
+ writer.uint32(10).string(message.sender);
6250
+ }
6251
+ if (message.oldPublicKey.length !== 0) {
6252
+ writer.uint32(18).bytes(message.oldPublicKey);
6253
+ }
6254
+ if (message.newPublicKey.length !== 0) {
6255
+ writer.uint32(26).bytes(message.newPublicKey);
6256
+ }
6257
+ if (message.oldSignature.length !== 0) {
6258
+ writer.uint32(34).bytes(message.oldSignature);
6259
+ }
6260
+ if (message.newSignature.length !== 0) {
6261
+ writer.uint32(42).bytes(message.newSignature);
6262
+ }
6263
+ return writer;
6264
+ },
6265
+ decode(input, length) {
6266
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
6267
+ const end = length === void 0 ? reader.len : reader.pos + length;
6268
+ const message = createBaseMsgRotatePQCKey();
6269
+ while (reader.pos < end) {
6270
+ const tag = reader.uint32();
6271
+ switch (tag >>> 3) {
6272
+ case 1: {
6273
+ if (tag !== 10) {
6274
+ break;
6275
+ }
6276
+ message.sender = reader.string();
6277
+ continue;
6278
+ }
6279
+ case 2: {
6280
+ if (tag !== 18) {
6281
+ break;
6282
+ }
6283
+ message.oldPublicKey = reader.bytes();
6284
+ continue;
6285
+ }
6286
+ case 3: {
6287
+ if (tag !== 26) {
6288
+ break;
6289
+ }
6290
+ message.newPublicKey = reader.bytes();
6291
+ continue;
6292
+ }
6293
+ case 4: {
6294
+ if (tag !== 34) {
6295
+ break;
6296
+ }
6297
+ message.oldSignature = reader.bytes();
6298
+ continue;
6299
+ }
6300
+ case 5: {
6301
+ if (tag !== 42) {
6302
+ break;
6303
+ }
6304
+ message.newSignature = reader.bytes();
6305
+ continue;
6306
+ }
6307
+ }
6308
+ if ((tag & 7) === 4 || tag === 0) {
6309
+ break;
6310
+ }
6311
+ reader.skip(tag & 7);
6312
+ }
6313
+ return message;
6314
+ },
6315
+ fromJSON(object) {
6316
+ return {
6317
+ sender: isSet6(object.sender) ? globalThis.String(object.sender) : "",
6318
+ oldPublicKey: isSet6(object.oldPublicKey) ? bytesFromBase644(object.oldPublicKey) : isSet6(object.old_public_key) ? bytesFromBase644(object.old_public_key) : new Uint8Array(0),
6319
+ newPublicKey: isSet6(object.newPublicKey) ? bytesFromBase644(object.newPublicKey) : isSet6(object.new_public_key) ? bytesFromBase644(object.new_public_key) : new Uint8Array(0),
6320
+ oldSignature: isSet6(object.oldSignature) ? bytesFromBase644(object.oldSignature) : isSet6(object.old_signature) ? bytesFromBase644(object.old_signature) : new Uint8Array(0),
6321
+ newSignature: isSet6(object.newSignature) ? bytesFromBase644(object.newSignature) : isSet6(object.new_signature) ? bytesFromBase644(object.new_signature) : new Uint8Array(0)
6322
+ };
6323
+ },
6324
+ toJSON(message) {
6325
+ const obj = {};
6326
+ if (message.sender !== "") {
6327
+ obj.sender = message.sender;
6328
+ }
6329
+ if (message.oldPublicKey.length !== 0) {
6330
+ obj.oldPublicKey = base64FromBytes4(message.oldPublicKey);
6331
+ }
6332
+ if (message.newPublicKey.length !== 0) {
6333
+ obj.newPublicKey = base64FromBytes4(message.newPublicKey);
6334
+ }
6335
+ if (message.oldSignature.length !== 0) {
6336
+ obj.oldSignature = base64FromBytes4(message.oldSignature);
6337
+ }
6338
+ if (message.newSignature.length !== 0) {
6339
+ obj.newSignature = base64FromBytes4(message.newSignature);
6340
+ }
6341
+ return obj;
6342
+ },
6343
+ create(base) {
6344
+ return MsgRotatePQCKey.fromPartial(base ?? {});
6345
+ },
6346
+ fromPartial(object) {
6347
+ const message = createBaseMsgRotatePQCKey();
6348
+ message.sender = object.sender ?? "";
6349
+ message.oldPublicKey = object.oldPublicKey ?? new Uint8Array(0);
6350
+ message.newPublicKey = object.newPublicKey ?? new Uint8Array(0);
6351
+ message.oldSignature = object.oldSignature ?? new Uint8Array(0);
6352
+ message.newSignature = object.newSignature ?? new Uint8Array(0);
6353
+ return message;
6354
+ }
6355
+ };
6356
+ function createBaseMsgRotatePQCKeyResponse() {
6357
+ return {};
6358
+ }
6359
+ var MsgRotatePQCKeyResponse = {
6360
+ encode(_, writer = new BinaryWriter()) {
6361
+ return writer;
6362
+ },
6363
+ decode(input, length) {
6364
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
6365
+ const end = length === void 0 ? reader.len : reader.pos + length;
6366
+ const message = createBaseMsgRotatePQCKeyResponse();
6367
+ while (reader.pos < end) {
6368
+ const tag = reader.uint32();
6369
+ if ((tag & 7) === 4 || tag === 0) {
6370
+ break;
6371
+ }
6372
+ reader.skip(tag & 7);
6373
+ }
6374
+ return message;
6375
+ },
6376
+ fromJSON(_) {
6377
+ return {};
6378
+ },
6379
+ toJSON(_) {
6380
+ const obj = {};
6381
+ return obj;
6382
+ },
6383
+ create(base) {
6384
+ return MsgRotatePQCKeyResponse.fromPartial(base ?? {});
6385
+ },
6386
+ fromPartial(_) {
6387
+ const message = createBaseMsgRotatePQCKeyResponse();
6388
+ return message;
6389
+ }
6390
+ };
6206
6391
  function createBaseMsgDeprecateAlgorithm() {
6207
6392
  return { authority: "", algorithmId: 0, migrationBlocks: "0", replacementAlgorithmId: 0 };
6208
6393
  }
@@ -6485,6 +6670,20 @@ var MsgDefinition5 = {
6485
6670
  responseStream: false,
6486
6671
  options: {}
6487
6672
  },
6673
+ /**
6674
+ * RotatePQCKey replaces an account's PQC key with a NEW key of the SAME
6675
+ * algorithm — for rotating a compromised key or moving a legacy-derived key to
6676
+ * the canonical derivation. Dual-signed (old proves ownership, new proves
6677
+ * control); needs no active algorithm migration.
6678
+ */
6679
+ rotatePQCKey: {
6680
+ name: "RotatePQCKey",
6681
+ requestType: MsgRotatePQCKey,
6682
+ requestStream: false,
6683
+ responseType: MsgRotatePQCKeyResponse,
6684
+ responseStream: false,
6685
+ options: {}
6686
+ },
6488
6687
  /** DeprecateAlgorithm starts the migration period for an algorithm (governance). */
6489
6688
  deprecateAlgorithm: {
6490
6689
  name: "DeprecateAlgorithm",
@@ -8359,6 +8558,10 @@ __export(tx_exports9, {
8359
8558
  MsgCreateAbstractAccount: () => MsgCreateAbstractAccount,
8360
8559
  MsgCreateAbstractAccountResponse: () => MsgCreateAbstractAccountResponse,
8361
8560
  MsgDefinition: () => MsgDefinition9,
8561
+ MsgExecuteCosmos: () => MsgExecuteCosmos,
8562
+ MsgExecuteCosmosResponse: () => MsgExecuteCosmosResponse,
8563
+ MsgExecuteEVM: () => MsgExecuteEVM,
8564
+ MsgExecuteEVMResponse: () => MsgExecuteEVMResponse,
8362
8565
  MsgRegisterAuthenticator: () => MsgRegisterAuthenticator,
8363
8566
  MsgRegisterAuthenticatorResponse: () => MsgRegisterAuthenticatorResponse,
8364
8567
  MsgRevokeAuthenticator: () => MsgRevokeAuthenticator,
@@ -9038,95 +9241,626 @@ var MsgRevokeAuthenticatorResponse = {
9038
9241
  return message;
9039
9242
  }
9040
9243
  };
9041
- var MsgDefinition9 = {
9042
- name: "Msg",
9043
- fullName: "qorechain.abstractaccount.v1.Msg",
9044
- methods: {
9045
- createAbstractAccount: {
9046
- name: "CreateAbstractAccount",
9047
- requestType: MsgCreateAbstractAccount,
9048
- requestStream: false,
9049
- responseType: MsgCreateAbstractAccountResponse,
9050
- responseStream: false,
9051
- options: {}
9052
- },
9053
- updateSpendingRules: {
9054
- name: "UpdateSpendingRules",
9055
- requestType: MsgUpdateSpendingRules,
9056
- requestStream: false,
9057
- responseType: MsgUpdateSpendingRulesResponse,
9058
- responseStream: false,
9059
- options: {}
9060
- },
9061
- registerAuthenticator: {
9062
- name: "RegisterAuthenticator",
9063
- requestType: MsgRegisterAuthenticator,
9064
- requestStream: false,
9065
- responseType: MsgRegisterAuthenticatorResponse,
9066
- responseStream: false,
9067
- options: {}
9068
- },
9069
- revokeAuthenticator: {
9070
- name: "RevokeAuthenticator",
9071
- requestType: MsgRevokeAuthenticator,
9072
- requestStream: false,
9073
- responseType: MsgRevokeAuthenticatorResponse,
9074
- responseStream: false,
9075
- options: {}
9076
- }
9077
- }
9078
- };
9079
- function bytesFromBase646(b64) {
9080
- if (globalThis.Buffer) {
9081
- return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
9082
- } else {
9083
- const bin = globalThis.atob(b64);
9084
- const arr = new Uint8Array(bin.length);
9085
- for (let i = 0; i < bin.length; ++i) {
9086
- arr[i] = bin.charCodeAt(i);
9087
- }
9088
- return arr;
9089
- }
9090
- }
9091
- function base64FromBytes6(arr) {
9092
- if (globalThis.Buffer) {
9093
- return globalThis.Buffer.from(arr).toString("base64");
9094
- } else {
9095
- const bin = [];
9096
- arr.forEach((byte) => {
9097
- bin.push(globalThis.String.fromCharCode(byte));
9098
- });
9099
- return globalThis.btoa(bin.join(""));
9100
- }
9101
- }
9102
- function isSet10(value) {
9103
- return value !== null && value !== void 0;
9104
- }
9105
-
9106
- // src/codegen/qorechain/crossvm/v1/tx.ts
9107
- var tx_exports10 = {};
9108
- __export(tx_exports10, {
9109
- MsgCrossVMCall: () => MsgCrossVMCall,
9110
- MsgCrossVMCallResponse: () => MsgCrossVMCallResponse,
9111
- MsgDefinition: () => MsgDefinition10,
9112
- MsgProcessQueue: () => MsgProcessQueue,
9113
- MsgProcessQueueResponse: () => MsgProcessQueueResponse,
9114
- protobufPackage: () => protobufPackage10
9115
- });
9116
- var protobufPackage10 = "qorechain.crossvm.v1";
9117
- function createBaseMsgCrossVMCall() {
9118
- return { sender: "", sourceVm: "", targetVm: "", targetContract: "", payload: new Uint8Array(0), funds: [] };
9244
+ function createBaseMsgExecuteEVM() {
9245
+ return {
9246
+ relayer: "",
9247
+ account: "",
9248
+ scheme: "",
9249
+ pubkey: new Uint8Array(0),
9250
+ signature: new Uint8Array(0),
9251
+ to: "",
9252
+ value: "",
9253
+ data: new Uint8Array(0),
9254
+ gasLimit: "0",
9255
+ nonce: "0"
9256
+ };
9119
9257
  }
9120
- var MsgCrossVMCall = {
9258
+ var MsgExecuteEVM = {
9121
9259
  encode(message, writer = new BinaryWriter()) {
9122
- if (message.sender !== "") {
9123
- writer.uint32(10).string(message.sender);
9260
+ if (message.relayer !== "") {
9261
+ writer.uint32(10).string(message.relayer);
9124
9262
  }
9125
- if (message.sourceVm !== "") {
9126
- writer.uint32(18).string(message.sourceVm);
9263
+ if (message.account !== "") {
9264
+ writer.uint32(18).string(message.account);
9127
9265
  }
9128
- if (message.targetVm !== "") {
9129
- writer.uint32(26).string(message.targetVm);
9266
+ if (message.scheme !== "") {
9267
+ writer.uint32(26).string(message.scheme);
9268
+ }
9269
+ if (message.pubkey.length !== 0) {
9270
+ writer.uint32(34).bytes(message.pubkey);
9271
+ }
9272
+ if (message.signature.length !== 0) {
9273
+ writer.uint32(42).bytes(message.signature);
9274
+ }
9275
+ if (message.to !== "") {
9276
+ writer.uint32(50).string(message.to);
9277
+ }
9278
+ if (message.value !== "") {
9279
+ writer.uint32(58).string(message.value);
9280
+ }
9281
+ if (message.data.length !== 0) {
9282
+ writer.uint32(66).bytes(message.data);
9283
+ }
9284
+ if (message.gasLimit !== "0") {
9285
+ writer.uint32(72).uint64(message.gasLimit);
9286
+ }
9287
+ if (message.nonce !== "0") {
9288
+ writer.uint32(80).uint64(message.nonce);
9289
+ }
9290
+ return writer;
9291
+ },
9292
+ decode(input, length) {
9293
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
9294
+ const end = length === void 0 ? reader.len : reader.pos + length;
9295
+ const message = createBaseMsgExecuteEVM();
9296
+ while (reader.pos < end) {
9297
+ const tag = reader.uint32();
9298
+ switch (tag >>> 3) {
9299
+ case 1: {
9300
+ if (tag !== 10) {
9301
+ break;
9302
+ }
9303
+ message.relayer = reader.string();
9304
+ continue;
9305
+ }
9306
+ case 2: {
9307
+ if (tag !== 18) {
9308
+ break;
9309
+ }
9310
+ message.account = reader.string();
9311
+ continue;
9312
+ }
9313
+ case 3: {
9314
+ if (tag !== 26) {
9315
+ break;
9316
+ }
9317
+ message.scheme = reader.string();
9318
+ continue;
9319
+ }
9320
+ case 4: {
9321
+ if (tag !== 34) {
9322
+ break;
9323
+ }
9324
+ message.pubkey = reader.bytes();
9325
+ continue;
9326
+ }
9327
+ case 5: {
9328
+ if (tag !== 42) {
9329
+ break;
9330
+ }
9331
+ message.signature = reader.bytes();
9332
+ continue;
9333
+ }
9334
+ case 6: {
9335
+ if (tag !== 50) {
9336
+ break;
9337
+ }
9338
+ message.to = reader.string();
9339
+ continue;
9340
+ }
9341
+ case 7: {
9342
+ if (tag !== 58) {
9343
+ break;
9344
+ }
9345
+ message.value = reader.string();
9346
+ continue;
9347
+ }
9348
+ case 8: {
9349
+ if (tag !== 66) {
9350
+ break;
9351
+ }
9352
+ message.data = reader.bytes();
9353
+ continue;
9354
+ }
9355
+ case 9: {
9356
+ if (tag !== 72) {
9357
+ break;
9358
+ }
9359
+ message.gasLimit = reader.uint64().toString();
9360
+ continue;
9361
+ }
9362
+ case 10: {
9363
+ if (tag !== 80) {
9364
+ break;
9365
+ }
9366
+ message.nonce = reader.uint64().toString();
9367
+ continue;
9368
+ }
9369
+ }
9370
+ if ((tag & 7) === 4 || tag === 0) {
9371
+ break;
9372
+ }
9373
+ reader.skip(tag & 7);
9374
+ }
9375
+ return message;
9376
+ },
9377
+ fromJSON(object) {
9378
+ return {
9379
+ relayer: isSet10(object.relayer) ? globalThis.String(object.relayer) : "",
9380
+ account: isSet10(object.account) ? globalThis.String(object.account) : "",
9381
+ scheme: isSet10(object.scheme) ? globalThis.String(object.scheme) : "",
9382
+ pubkey: isSet10(object.pubkey) ? bytesFromBase646(object.pubkey) : new Uint8Array(0),
9383
+ signature: isSet10(object.signature) ? bytesFromBase646(object.signature) : new Uint8Array(0),
9384
+ to: isSet10(object.to) ? globalThis.String(object.to) : "",
9385
+ value: isSet10(object.value) ? globalThis.String(object.value) : "",
9386
+ data: isSet10(object.data) ? bytesFromBase646(object.data) : new Uint8Array(0),
9387
+ gasLimit: isSet10(object.gasLimit) ? globalThis.String(object.gasLimit) : isSet10(object.gas_limit) ? globalThis.String(object.gas_limit) : "0",
9388
+ nonce: isSet10(object.nonce) ? globalThis.String(object.nonce) : "0"
9389
+ };
9390
+ },
9391
+ toJSON(message) {
9392
+ const obj = {};
9393
+ if (message.relayer !== "") {
9394
+ obj.relayer = message.relayer;
9395
+ }
9396
+ if (message.account !== "") {
9397
+ obj.account = message.account;
9398
+ }
9399
+ if (message.scheme !== "") {
9400
+ obj.scheme = message.scheme;
9401
+ }
9402
+ if (message.pubkey.length !== 0) {
9403
+ obj.pubkey = base64FromBytes6(message.pubkey);
9404
+ }
9405
+ if (message.signature.length !== 0) {
9406
+ obj.signature = base64FromBytes6(message.signature);
9407
+ }
9408
+ if (message.to !== "") {
9409
+ obj.to = message.to;
9410
+ }
9411
+ if (message.value !== "") {
9412
+ obj.value = message.value;
9413
+ }
9414
+ if (message.data.length !== 0) {
9415
+ obj.data = base64FromBytes6(message.data);
9416
+ }
9417
+ if (message.gasLimit !== "0") {
9418
+ obj.gasLimit = message.gasLimit;
9419
+ }
9420
+ if (message.nonce !== "0") {
9421
+ obj.nonce = message.nonce;
9422
+ }
9423
+ return obj;
9424
+ },
9425
+ create(base) {
9426
+ return MsgExecuteEVM.fromPartial(base ?? {});
9427
+ },
9428
+ fromPartial(object) {
9429
+ const message = createBaseMsgExecuteEVM();
9430
+ message.relayer = object.relayer ?? "";
9431
+ message.account = object.account ?? "";
9432
+ message.scheme = object.scheme ?? "";
9433
+ message.pubkey = object.pubkey ?? new Uint8Array(0);
9434
+ message.signature = object.signature ?? new Uint8Array(0);
9435
+ message.to = object.to ?? "";
9436
+ message.value = object.value ?? "";
9437
+ message.data = object.data ?? new Uint8Array(0);
9438
+ message.gasLimit = object.gasLimit ?? "0";
9439
+ message.nonce = object.nonce ?? "0";
9440
+ return message;
9441
+ }
9442
+ };
9443
+ function createBaseMsgExecuteEVMResponse() {
9444
+ return { success: false, ret: new Uint8Array(0), gasUsed: "0", vmError: "" };
9445
+ }
9446
+ var MsgExecuteEVMResponse = {
9447
+ encode(message, writer = new BinaryWriter()) {
9448
+ if (message.success !== false) {
9449
+ writer.uint32(8).bool(message.success);
9450
+ }
9451
+ if (message.ret.length !== 0) {
9452
+ writer.uint32(18).bytes(message.ret);
9453
+ }
9454
+ if (message.gasUsed !== "0") {
9455
+ writer.uint32(24).uint64(message.gasUsed);
9456
+ }
9457
+ if (message.vmError !== "") {
9458
+ writer.uint32(34).string(message.vmError);
9459
+ }
9460
+ return writer;
9461
+ },
9462
+ decode(input, length) {
9463
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
9464
+ const end = length === void 0 ? reader.len : reader.pos + length;
9465
+ const message = createBaseMsgExecuteEVMResponse();
9466
+ while (reader.pos < end) {
9467
+ const tag = reader.uint32();
9468
+ switch (tag >>> 3) {
9469
+ case 1: {
9470
+ if (tag !== 8) {
9471
+ break;
9472
+ }
9473
+ message.success = reader.bool();
9474
+ continue;
9475
+ }
9476
+ case 2: {
9477
+ if (tag !== 18) {
9478
+ break;
9479
+ }
9480
+ message.ret = reader.bytes();
9481
+ continue;
9482
+ }
9483
+ case 3: {
9484
+ if (tag !== 24) {
9485
+ break;
9486
+ }
9487
+ message.gasUsed = reader.uint64().toString();
9488
+ continue;
9489
+ }
9490
+ case 4: {
9491
+ if (tag !== 34) {
9492
+ break;
9493
+ }
9494
+ message.vmError = reader.string();
9495
+ continue;
9496
+ }
9497
+ }
9498
+ if ((tag & 7) === 4 || tag === 0) {
9499
+ break;
9500
+ }
9501
+ reader.skip(tag & 7);
9502
+ }
9503
+ return message;
9504
+ },
9505
+ fromJSON(object) {
9506
+ return {
9507
+ success: isSet10(object.success) ? globalThis.Boolean(object.success) : false,
9508
+ ret: isSet10(object.ret) ? bytesFromBase646(object.ret) : new Uint8Array(0),
9509
+ gasUsed: isSet10(object.gasUsed) ? globalThis.String(object.gasUsed) : isSet10(object.gas_used) ? globalThis.String(object.gas_used) : "0",
9510
+ vmError: isSet10(object.vmError) ? globalThis.String(object.vmError) : isSet10(object.vm_error) ? globalThis.String(object.vm_error) : ""
9511
+ };
9512
+ },
9513
+ toJSON(message) {
9514
+ const obj = {};
9515
+ if (message.success !== false) {
9516
+ obj.success = message.success;
9517
+ }
9518
+ if (message.ret.length !== 0) {
9519
+ obj.ret = base64FromBytes6(message.ret);
9520
+ }
9521
+ if (message.gasUsed !== "0") {
9522
+ obj.gasUsed = message.gasUsed;
9523
+ }
9524
+ if (message.vmError !== "") {
9525
+ obj.vmError = message.vmError;
9526
+ }
9527
+ return obj;
9528
+ },
9529
+ create(base) {
9530
+ return MsgExecuteEVMResponse.fromPartial(base ?? {});
9531
+ },
9532
+ fromPartial(object) {
9533
+ const message = createBaseMsgExecuteEVMResponse();
9534
+ message.success = object.success ?? false;
9535
+ message.ret = object.ret ?? new Uint8Array(0);
9536
+ message.gasUsed = object.gasUsed ?? "0";
9537
+ message.vmError = object.vmError ?? "";
9538
+ return message;
9539
+ }
9540
+ };
9541
+ function createBaseMsgExecuteCosmos() {
9542
+ return {
9543
+ relayer: "",
9544
+ account: "",
9545
+ scheme: "",
9546
+ pubkey: new Uint8Array(0),
9547
+ signature: new Uint8Array(0),
9548
+ to: "",
9549
+ amount: [],
9550
+ nonce: "0"
9551
+ };
9552
+ }
9553
+ var MsgExecuteCosmos = {
9554
+ encode(message, writer = new BinaryWriter()) {
9555
+ if (message.relayer !== "") {
9556
+ writer.uint32(10).string(message.relayer);
9557
+ }
9558
+ if (message.account !== "") {
9559
+ writer.uint32(18).string(message.account);
9560
+ }
9561
+ if (message.scheme !== "") {
9562
+ writer.uint32(26).string(message.scheme);
9563
+ }
9564
+ if (message.pubkey.length !== 0) {
9565
+ writer.uint32(34).bytes(message.pubkey);
9566
+ }
9567
+ if (message.signature.length !== 0) {
9568
+ writer.uint32(42).bytes(message.signature);
9569
+ }
9570
+ if (message.to !== "") {
9571
+ writer.uint32(50).string(message.to);
9572
+ }
9573
+ for (const v of message.amount) {
9574
+ Coin.encode(v, writer.uint32(58).fork()).join();
9575
+ }
9576
+ if (message.nonce !== "0") {
9577
+ writer.uint32(64).uint64(message.nonce);
9578
+ }
9579
+ return writer;
9580
+ },
9581
+ decode(input, length) {
9582
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
9583
+ const end = length === void 0 ? reader.len : reader.pos + length;
9584
+ const message = createBaseMsgExecuteCosmos();
9585
+ while (reader.pos < end) {
9586
+ const tag = reader.uint32();
9587
+ switch (tag >>> 3) {
9588
+ case 1: {
9589
+ if (tag !== 10) {
9590
+ break;
9591
+ }
9592
+ message.relayer = reader.string();
9593
+ continue;
9594
+ }
9595
+ case 2: {
9596
+ if (tag !== 18) {
9597
+ break;
9598
+ }
9599
+ message.account = reader.string();
9600
+ continue;
9601
+ }
9602
+ case 3: {
9603
+ if (tag !== 26) {
9604
+ break;
9605
+ }
9606
+ message.scheme = reader.string();
9607
+ continue;
9608
+ }
9609
+ case 4: {
9610
+ if (tag !== 34) {
9611
+ break;
9612
+ }
9613
+ message.pubkey = reader.bytes();
9614
+ continue;
9615
+ }
9616
+ case 5: {
9617
+ if (tag !== 42) {
9618
+ break;
9619
+ }
9620
+ message.signature = reader.bytes();
9621
+ continue;
9622
+ }
9623
+ case 6: {
9624
+ if (tag !== 50) {
9625
+ break;
9626
+ }
9627
+ message.to = reader.string();
9628
+ continue;
9629
+ }
9630
+ case 7: {
9631
+ if (tag !== 58) {
9632
+ break;
9633
+ }
9634
+ message.amount.push(Coin.decode(reader, reader.uint32()));
9635
+ continue;
9636
+ }
9637
+ case 8: {
9638
+ if (tag !== 64) {
9639
+ break;
9640
+ }
9641
+ message.nonce = reader.uint64().toString();
9642
+ continue;
9643
+ }
9644
+ }
9645
+ if ((tag & 7) === 4 || tag === 0) {
9646
+ break;
9647
+ }
9648
+ reader.skip(tag & 7);
9649
+ }
9650
+ return message;
9651
+ },
9652
+ fromJSON(object) {
9653
+ return {
9654
+ relayer: isSet10(object.relayer) ? globalThis.String(object.relayer) : "",
9655
+ account: isSet10(object.account) ? globalThis.String(object.account) : "",
9656
+ scheme: isSet10(object.scheme) ? globalThis.String(object.scheme) : "",
9657
+ pubkey: isSet10(object.pubkey) ? bytesFromBase646(object.pubkey) : new Uint8Array(0),
9658
+ signature: isSet10(object.signature) ? bytesFromBase646(object.signature) : new Uint8Array(0),
9659
+ to: isSet10(object.to) ? globalThis.String(object.to) : "",
9660
+ amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e) => Coin.fromJSON(e)) : [],
9661
+ nonce: isSet10(object.nonce) ? globalThis.String(object.nonce) : "0"
9662
+ };
9663
+ },
9664
+ toJSON(message) {
9665
+ const obj = {};
9666
+ if (message.relayer !== "") {
9667
+ obj.relayer = message.relayer;
9668
+ }
9669
+ if (message.account !== "") {
9670
+ obj.account = message.account;
9671
+ }
9672
+ if (message.scheme !== "") {
9673
+ obj.scheme = message.scheme;
9674
+ }
9675
+ if (message.pubkey.length !== 0) {
9676
+ obj.pubkey = base64FromBytes6(message.pubkey);
9677
+ }
9678
+ if (message.signature.length !== 0) {
9679
+ obj.signature = base64FromBytes6(message.signature);
9680
+ }
9681
+ if (message.to !== "") {
9682
+ obj.to = message.to;
9683
+ }
9684
+ if (message.amount?.length) {
9685
+ obj.amount = message.amount.map((e) => Coin.toJSON(e));
9686
+ }
9687
+ if (message.nonce !== "0") {
9688
+ obj.nonce = message.nonce;
9689
+ }
9690
+ return obj;
9691
+ },
9692
+ create(base) {
9693
+ return MsgExecuteCosmos.fromPartial(base ?? {});
9694
+ },
9695
+ fromPartial(object) {
9696
+ const message = createBaseMsgExecuteCosmos();
9697
+ message.relayer = object.relayer ?? "";
9698
+ message.account = object.account ?? "";
9699
+ message.scheme = object.scheme ?? "";
9700
+ message.pubkey = object.pubkey ?? new Uint8Array(0);
9701
+ message.signature = object.signature ?? new Uint8Array(0);
9702
+ message.to = object.to ?? "";
9703
+ message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || [];
9704
+ message.nonce = object.nonce ?? "0";
9705
+ return message;
9706
+ }
9707
+ };
9708
+ function createBaseMsgExecuteCosmosResponse() {
9709
+ return { success: false };
9710
+ }
9711
+ var MsgExecuteCosmosResponse = {
9712
+ encode(message, writer = new BinaryWriter()) {
9713
+ if (message.success !== false) {
9714
+ writer.uint32(8).bool(message.success);
9715
+ }
9716
+ return writer;
9717
+ },
9718
+ decode(input, length) {
9719
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
9720
+ const end = length === void 0 ? reader.len : reader.pos + length;
9721
+ const message = createBaseMsgExecuteCosmosResponse();
9722
+ while (reader.pos < end) {
9723
+ const tag = reader.uint32();
9724
+ switch (tag >>> 3) {
9725
+ case 1: {
9726
+ if (tag !== 8) {
9727
+ break;
9728
+ }
9729
+ message.success = reader.bool();
9730
+ continue;
9731
+ }
9732
+ }
9733
+ if ((tag & 7) === 4 || tag === 0) {
9734
+ break;
9735
+ }
9736
+ reader.skip(tag & 7);
9737
+ }
9738
+ return message;
9739
+ },
9740
+ fromJSON(object) {
9741
+ return { success: isSet10(object.success) ? globalThis.Boolean(object.success) : false };
9742
+ },
9743
+ toJSON(message) {
9744
+ const obj = {};
9745
+ if (message.success !== false) {
9746
+ obj.success = message.success;
9747
+ }
9748
+ return obj;
9749
+ },
9750
+ create(base) {
9751
+ return MsgExecuteCosmosResponse.fromPartial(base ?? {});
9752
+ },
9753
+ fromPartial(object) {
9754
+ const message = createBaseMsgExecuteCosmosResponse();
9755
+ message.success = object.success ?? false;
9756
+ return message;
9757
+ }
9758
+ };
9759
+ var MsgDefinition9 = {
9760
+ name: "Msg",
9761
+ fullName: "qorechain.abstractaccount.v1.Msg",
9762
+ methods: {
9763
+ createAbstractAccount: {
9764
+ name: "CreateAbstractAccount",
9765
+ requestType: MsgCreateAbstractAccount,
9766
+ requestStream: false,
9767
+ responseType: MsgCreateAbstractAccountResponse,
9768
+ responseStream: false,
9769
+ options: {}
9770
+ },
9771
+ updateSpendingRules: {
9772
+ name: "UpdateSpendingRules",
9773
+ requestType: MsgUpdateSpendingRules,
9774
+ requestStream: false,
9775
+ responseType: MsgUpdateSpendingRulesResponse,
9776
+ responseStream: false,
9777
+ options: {}
9778
+ },
9779
+ registerAuthenticator: {
9780
+ name: "RegisterAuthenticator",
9781
+ requestType: MsgRegisterAuthenticator,
9782
+ requestStream: false,
9783
+ responseType: MsgRegisterAuthenticatorResponse,
9784
+ responseStream: false,
9785
+ options: {}
9786
+ },
9787
+ revokeAuthenticator: {
9788
+ name: "RevokeAuthenticator",
9789
+ requestType: MsgRevokeAuthenticator,
9790
+ requestStream: false,
9791
+ responseType: MsgRevokeAuthenticatorResponse,
9792
+ responseStream: false,
9793
+ options: {}
9794
+ },
9795
+ executeEVM: {
9796
+ name: "ExecuteEVM",
9797
+ requestType: MsgExecuteEVM,
9798
+ requestStream: false,
9799
+ responseType: MsgExecuteEVMResponse,
9800
+ responseStream: false,
9801
+ options: {}
9802
+ },
9803
+ executeCosmos: {
9804
+ name: "ExecuteCosmos",
9805
+ requestType: MsgExecuteCosmos,
9806
+ requestStream: false,
9807
+ responseType: MsgExecuteCosmosResponse,
9808
+ responseStream: false,
9809
+ options: {}
9810
+ }
9811
+ }
9812
+ };
9813
+ function bytesFromBase646(b64) {
9814
+ if (globalThis.Buffer) {
9815
+ return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
9816
+ } else {
9817
+ const bin = globalThis.atob(b64);
9818
+ const arr = new Uint8Array(bin.length);
9819
+ for (let i = 0; i < bin.length; ++i) {
9820
+ arr[i] = bin.charCodeAt(i);
9821
+ }
9822
+ return arr;
9823
+ }
9824
+ }
9825
+ function base64FromBytes6(arr) {
9826
+ if (globalThis.Buffer) {
9827
+ return globalThis.Buffer.from(arr).toString("base64");
9828
+ } else {
9829
+ const bin = [];
9830
+ arr.forEach((byte) => {
9831
+ bin.push(globalThis.String.fromCharCode(byte));
9832
+ });
9833
+ return globalThis.btoa(bin.join(""));
9834
+ }
9835
+ }
9836
+ function isSet10(value) {
9837
+ return value !== null && value !== void 0;
9838
+ }
9839
+
9840
+ // src/codegen/qorechain/crossvm/v1/tx.ts
9841
+ var tx_exports10 = {};
9842
+ __export(tx_exports10, {
9843
+ MsgCrossVMCall: () => MsgCrossVMCall,
9844
+ MsgCrossVMCallResponse: () => MsgCrossVMCallResponse,
9845
+ MsgDefinition: () => MsgDefinition10,
9846
+ MsgProcessQueue: () => MsgProcessQueue,
9847
+ MsgProcessQueueResponse: () => MsgProcessQueueResponse,
9848
+ protobufPackage: () => protobufPackage10
9849
+ });
9850
+ var protobufPackage10 = "qorechain.crossvm.v1";
9851
+ function createBaseMsgCrossVMCall() {
9852
+ return { sender: "", sourceVm: "", targetVm: "", targetContract: "", payload: new Uint8Array(0), funds: [] };
9853
+ }
9854
+ var MsgCrossVMCall = {
9855
+ encode(message, writer = new BinaryWriter()) {
9856
+ if (message.sender !== "") {
9857
+ writer.uint32(10).string(message.sender);
9858
+ }
9859
+ if (message.sourceVm !== "") {
9860
+ writer.uint32(18).string(message.sourceVm);
9861
+ }
9862
+ if (message.targetVm !== "") {
9863
+ writer.uint32(26).string(message.targetVm);
9130
9864
  }
9131
9865
  if (message.targetContract !== "") {
9132
9866
  writer.uint32(34).string(message.targetContract);
@@ -10001,6 +10735,7 @@ var qorechainRegistryTypes = [
10001
10735
  ["/qorechain.pqc.v1.MsgRegisterPQCKey", MsgRegisterPQCKey],
10002
10736
  ["/qorechain.pqc.v1.MsgRegisterPQCKeyV2", MsgRegisterPQCKeyV2],
10003
10737
  ["/qorechain.pqc.v1.MsgMigratePQCKey", MsgMigratePQCKey],
10738
+ ["/qorechain.pqc.v1.MsgRotatePQCKey", MsgRotatePQCKey],
10004
10739
  ["/qorechain.pqc.v1.MsgDeprecateAlgorithm", MsgDeprecateAlgorithm],
10005
10740
  ["/qorechain.pqc.v1.MsgDisableAlgorithm", MsgDisableAlgorithm],
10006
10741
  // svm
@@ -10041,6 +10776,11 @@ var qorechainRegistryTypes = [
10041
10776
  "/qorechain.abstractaccount.v1.MsgRevokeAuthenticator",
10042
10777
  MsgRevokeAuthenticator
10043
10778
  ],
10779
+ ["/qorechain.abstractaccount.v1.MsgExecuteEVM", MsgExecuteEVM],
10780
+ [
10781
+ "/qorechain.abstractaccount.v1.MsgExecuteCosmos",
10782
+ MsgExecuteCosmos
10783
+ ],
10044
10784
  // crossvm
10045
10785
  ["/qorechain.crossvm.v1.MsgCrossVMCall", MsgCrossVMCall],
10046
10786
  ["/qorechain.crossvm.v1.MsgProcessQueue", MsgProcessQueue],
@@ -10089,6 +10829,34 @@ var SDK_CODES = {
10089
10829
  25: { kind: "invalid_gas_limit", message: "invalid gas limit" },
10090
10830
  30: { kind: "tx_timeout_height", message: "transaction timeout height exceeded" }
10091
10831
  };
10832
+ var ABSTRACTACCOUNT_CODES = {
10833
+ 5: {
10834
+ kind: "spending_limit_exceeded",
10835
+ message: "spending limit exceeded \u2014 the amount is over the authenticator's per-tx or daily SpendingRule"
10836
+ },
10837
+ 6: {
10838
+ kind: "session_key_expired",
10839
+ message: "session key expired \u2014 the authenticator's expiry_unix has passed; re-register the key"
10840
+ },
10841
+ 10: {
10842
+ kind: "permission_denied",
10843
+ message: "permission denied \u2014 the authenticator lacks the permission this message requires (check the permission_schema)"
10844
+ },
10845
+ 11: {
10846
+ kind: "authenticator_replay",
10847
+ message: "authenticator replay \u2014 the nonce does not match the account's expected value; refetch the current nonce/sequence and re-sign"
10848
+ }
10849
+ };
10850
+ var PQC_CODES = {
10851
+ 21: {
10852
+ kind: "hybrid_verify_failed",
10853
+ message: "hybrid signature verification failed \u2014 the ML-DSA-87 signature did not verify (ensure deterministic signing; hedged signatures are rejected)"
10854
+ }
10855
+ };
10856
+ var MODULE_CODES = {
10857
+ abstractaccount: ABSTRACTACCOUNT_CODES,
10858
+ pqc: PQC_CODES
10859
+ };
10092
10860
  var DEFAULT_CODESPACE = "sdk";
10093
10861
  function decodeTxError(input) {
10094
10862
  const codespace = input.codespace || DEFAULT_CODESPACE;
@@ -10104,6 +10872,17 @@ function decodeTxError(input) {
10104
10872
  rawLog
10105
10873
  };
10106
10874
  }
10875
+ } else {
10876
+ const known = MODULE_CODES[codespace]?.[input.code];
10877
+ if (known) {
10878
+ return {
10879
+ code: input.code,
10880
+ codespace,
10881
+ kind: known.kind,
10882
+ message: rawLog ? `${known.message} (${rawLog})` : known.message,
10883
+ rawLog
10884
+ };
10885
+ }
10107
10886
  }
10108
10887
  const detail = rawLog && rawLog.length > 0 ? rawLog : "(no log provided)";
10109
10888
  return {
@@ -11339,6 +12118,82 @@ async function withRetry2(fn, opts = {}) {
11339
12118
  throw lastError;
11340
12119
  }
11341
12120
 
12121
+ // src/tx/authenticator.ts
12122
+ var enc = new TextEncoder();
12123
+ var EVM_AUTH_DOMAIN = "qorechain-evm-auth-v1";
12124
+ var COSMOS_AUTH_DOMAIN = "qorechain-cosmos-auth-v1";
12125
+ var ROTATE_DOMAIN = "qorechain-pqc-rotate-v1";
12126
+ function be64(n) {
12127
+ const b = new Uint8Array(8);
12128
+ let v = BigInt(n);
12129
+ if (v < 0n) throw new Error(`be64: value must be non-negative, got ${n}`);
12130
+ for (let i = 7; i >= 0; i--) {
12131
+ b[i] = Number(v & 0xffn);
12132
+ v >>= 8n;
12133
+ }
12134
+ return b;
12135
+ }
12136
+ function concat(parts) {
12137
+ let len = 0;
12138
+ for (const p of parts) len += p.length;
12139
+ const out = new Uint8Array(len);
12140
+ let o = 0;
12141
+ for (const p of parts) {
12142
+ out.set(p, o);
12143
+ o += p.length;
12144
+ }
12145
+ return out;
12146
+ }
12147
+ function lengthPrefixed(bytes) {
12148
+ return concat([be64(bytes.length), bytes]);
12149
+ }
12150
+ function toBytes2(x) {
12151
+ return typeof x === "string" ? enc.encode(x) : x;
12152
+ }
12153
+ function toHexLower(bytes) {
12154
+ let s = "";
12155
+ for (const b of bytes) s += b.toString(16).padStart(2, "0");
12156
+ return s;
12157
+ }
12158
+ function evmAuthSignBytes(input) {
12159
+ const {
12160
+ chainId,
12161
+ account,
12162
+ pubkey,
12163
+ to = "",
12164
+ value = "0",
12165
+ data = new Uint8Array(0),
12166
+ nonce
12167
+ } = input;
12168
+ const body = concat([
12169
+ enc.encode(EVM_AUTH_DOMAIN),
12170
+ lengthPrefixed(toBytes2(chainId)),
12171
+ lengthPrefixed(toBytes2(account)),
12172
+ lengthPrefixed(pubkey),
12173
+ lengthPrefixed(toBytes2(to)),
12174
+ lengthPrefixed(toBytes2(value)),
12175
+ lengthPrefixed(data),
12176
+ be64(nonce)
12177
+ ]);
12178
+ return sha256(body);
12179
+ }
12180
+ function cosmosAuthSignBytes(input) {
12181
+ const { chainId, account, pubkey, to, amount, nonce } = input;
12182
+ const body = concat([
12183
+ enc.encode(COSMOS_AUTH_DOMAIN),
12184
+ lengthPrefixed(toBytes2(chainId)),
12185
+ lengthPrefixed(toBytes2(account)),
12186
+ lengthPrefixed(pubkey),
12187
+ lengthPrefixed(toBytes2(to)),
12188
+ lengthPrefixed(toBytes2(amount)),
12189
+ be64(nonce)
12190
+ ]);
12191
+ return sha256(body);
12192
+ }
12193
+ function rotationSignBytes(chainId, algorithmId, account, oldPub, newPub) {
12194
+ return `${ROTATE_DOMAIN}|${chainId}|${algorithmId}|${account}|${toHexLower(oldPub)}|${toHexLower(newPub)}`;
12195
+ }
12196
+
11342
12197
  // src/codegen/qorechain/pqc/v1/hybrid.ts
11343
12198
  var hybrid_exports = {};
11344
12199
  __export(hybrid_exports, {
@@ -11638,9 +12493,9 @@ function concatBytes2(...parts) {
11638
12493
  return out;
11639
12494
  }
11640
12495
  function encodeMessages(params) {
11641
- const enc = params.encodeMessage;
12496
+ const enc3 = params.encodeMessage;
11642
12497
  return params.messages.map((m) => {
11643
- if (enc) return enc(m);
12498
+ if (enc3) return enc3(m);
11644
12499
  if (m.value instanceof Uint8Array) {
11645
12500
  return Any.fromPartial({ typeUrl: m.typeUrl, value: m.value });
11646
12501
  }
@@ -12067,6 +12922,17 @@ var pqc = {
12067
12922
  disableAlgorithm: composer2(
12068
12923
  "/qorechain.pqc.v1.MsgDisableAlgorithm",
12069
12924
  MsgDisableAlgorithm
12925
+ ),
12926
+ /**
12927
+ * Replace an account's PQC key with a NEW key of the SAME algorithm (rotate a
12928
+ * compromised key, or migrate a legacy-derived key to the canonical
12929
+ * derivation). Dual-signed over the domain-separated rotation bytes (the old
12930
+ * key proves ownership, the new key proves control). Sender-signed; broadcast
12931
+ * BY the account, cosigned (hybrid) with the OLD key.
12932
+ */
12933
+ rotatePqcKey: composer2(
12934
+ "/qorechain.pqc.v1.MsgRotatePQCKey",
12935
+ MsgRotatePQCKey
12070
12936
  )
12071
12937
  };
12072
12938
  var svm = {
@@ -12145,6 +13011,26 @@ var abstractaccount = {
12145
13011
  revokeAuthenticator: composer2(
12146
13012
  "/qorechain.abstractaccount.v1.MsgRevokeAuthenticator",
12147
13013
  MsgRevokeAuthenticator
13014
+ ),
13015
+ /**
13016
+ * EVM-lane spend: execute an EVM call/transfer FROM the canonical account's
13017
+ * 0x address, authorized by a linked authenticator's signature over the EVM
13018
+ * auth sign-bytes. Relayer-signed (it submits + pays fees). See
13019
+ * {@link ../tx/authenticator.evmAuthSignBytes}.
13020
+ */
13021
+ executeEvm: composer2(
13022
+ "/qorechain.abstractaccount.v1.MsgExecuteEVM",
13023
+ MsgExecuteEVM
13024
+ ),
13025
+ /**
13026
+ * Native-lane spend: move native QOR FROM the canonical account via x/bank,
13027
+ * authorized by a linked authenticator's signature over the Cosmos auth
13028
+ * sign-bytes. Relayer-signed (it submits + pays fees). See
13029
+ * {@link ../tx/authenticator.cosmosAuthSignBytes}.
13030
+ */
13031
+ executeCosmos: composer2(
13032
+ "/qorechain.abstractaccount.v1.MsgExecuteCosmos",
13033
+ MsgExecuteCosmos
12148
13034
  )
12149
13035
  };
12150
13036
  var crossvm = {
@@ -12242,6 +13128,9 @@ __export(query_exports, {
12242
13128
  QueryConfigRequest: () => QueryConfigRequest,
12243
13129
  QueryConfigResponse: () => QueryConfigResponse,
12244
13130
  QueryDefinition: () => QueryDefinition,
13131
+ QueryPermissionSchemaRequest: () => QueryPermissionSchemaRequest,
13132
+ QueryPermissionSchemaResponse: () => QueryPermissionSchemaResponse,
13133
+ QueryPermissionSchemaResponse_MsgPermissionsEntry: () => QueryPermissionSchemaResponse_MsgPermissionsEntry,
12245
13134
  protobufPackage: () => protobufPackage13
12246
13135
  });
12247
13136
  var protobufPackage13 = "qorechain.abstractaccount.v1";
@@ -12770,6 +13659,236 @@ var QueryAccountsResponse = {
12770
13659
  return message;
12771
13660
  }
12772
13661
  };
13662
+ function createBaseQueryPermissionSchemaRequest() {
13663
+ return {};
13664
+ }
13665
+ var QueryPermissionSchemaRequest = {
13666
+ encode(_, writer = new BinaryWriter()) {
13667
+ return writer;
13668
+ },
13669
+ decode(input, length) {
13670
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
13671
+ const end = length === void 0 ? reader.len : reader.pos + length;
13672
+ const message = createBaseQueryPermissionSchemaRequest();
13673
+ while (reader.pos < end) {
13674
+ const tag = reader.uint32();
13675
+ if ((tag & 7) === 4 || tag === 0) {
13676
+ break;
13677
+ }
13678
+ reader.skip(tag & 7);
13679
+ }
13680
+ return message;
13681
+ },
13682
+ fromJSON(_) {
13683
+ return {};
13684
+ },
13685
+ toJSON(_) {
13686
+ const obj = {};
13687
+ return obj;
13688
+ },
13689
+ create(base) {
13690
+ return QueryPermissionSchemaRequest.fromPartial(base ?? {});
13691
+ },
13692
+ fromPartial(_) {
13693
+ const message = createBaseQueryPermissionSchemaRequest();
13694
+ return message;
13695
+ }
13696
+ };
13697
+ function createBaseQueryPermissionSchemaResponse() {
13698
+ return { schemaVersion: "", permissions: [], msgPermissions: {}, keyManagementMsgs: [] };
13699
+ }
13700
+ var QueryPermissionSchemaResponse = {
13701
+ encode(message, writer = new BinaryWriter()) {
13702
+ if (message.schemaVersion !== "") {
13703
+ writer.uint32(10).string(message.schemaVersion);
13704
+ }
13705
+ for (const v of message.permissions) {
13706
+ writer.uint32(18).string(v);
13707
+ }
13708
+ globalThis.Object.entries(message.msgPermissions).forEach(([key, value]) => {
13709
+ QueryPermissionSchemaResponse_MsgPermissionsEntry.encode({ key, value }, writer.uint32(26).fork()).join();
13710
+ });
13711
+ for (const v of message.keyManagementMsgs) {
13712
+ writer.uint32(34).string(v);
13713
+ }
13714
+ return writer;
13715
+ },
13716
+ decode(input, length) {
13717
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
13718
+ const end = length === void 0 ? reader.len : reader.pos + length;
13719
+ const message = createBaseQueryPermissionSchemaResponse();
13720
+ while (reader.pos < end) {
13721
+ const tag = reader.uint32();
13722
+ switch (tag >>> 3) {
13723
+ case 1: {
13724
+ if (tag !== 10) {
13725
+ break;
13726
+ }
13727
+ message.schemaVersion = reader.string();
13728
+ continue;
13729
+ }
13730
+ case 2: {
13731
+ if (tag !== 18) {
13732
+ break;
13733
+ }
13734
+ message.permissions.push(reader.string());
13735
+ continue;
13736
+ }
13737
+ case 3: {
13738
+ if (tag !== 26) {
13739
+ break;
13740
+ }
13741
+ const entry3 = QueryPermissionSchemaResponse_MsgPermissionsEntry.decode(reader, reader.uint32());
13742
+ if (entry3.value !== void 0) {
13743
+ message.msgPermissions[entry3.key] = entry3.value;
13744
+ }
13745
+ continue;
13746
+ }
13747
+ case 4: {
13748
+ if (tag !== 34) {
13749
+ break;
13750
+ }
13751
+ message.keyManagementMsgs.push(reader.string());
13752
+ continue;
13753
+ }
13754
+ }
13755
+ if ((tag & 7) === 4 || tag === 0) {
13756
+ break;
13757
+ }
13758
+ reader.skip(tag & 7);
13759
+ }
13760
+ return message;
13761
+ },
13762
+ fromJSON(object) {
13763
+ return {
13764
+ schemaVersion: isSet14(object.schemaVersion) ? globalThis.String(object.schemaVersion) : isSet14(object.schema_version) ? globalThis.String(object.schema_version) : "",
13765
+ permissions: globalThis.Array.isArray(object?.permissions) ? object.permissions.map((e) => globalThis.String(e)) : [],
13766
+ msgPermissions: isObject(object.msgPermissions) ? globalThis.Object.entries(object.msgPermissions).reduce(
13767
+ (acc, [key, value]) => {
13768
+ acc[key] = globalThis.String(value);
13769
+ return acc;
13770
+ },
13771
+ {}
13772
+ ) : isObject(object.msg_permissions) ? globalThis.Object.entries(object.msg_permissions).reduce(
13773
+ (acc, [key, value]) => {
13774
+ acc[key] = globalThis.String(value);
13775
+ return acc;
13776
+ },
13777
+ {}
13778
+ ) : {},
13779
+ keyManagementMsgs: globalThis.Array.isArray(object?.keyManagementMsgs) ? object.keyManagementMsgs.map((e) => globalThis.String(e)) : globalThis.Array.isArray(object?.key_management_msgs) ? object.key_management_msgs.map((e) => globalThis.String(e)) : []
13780
+ };
13781
+ },
13782
+ toJSON(message) {
13783
+ const obj = {};
13784
+ if (message.schemaVersion !== "") {
13785
+ obj.schemaVersion = message.schemaVersion;
13786
+ }
13787
+ if (message.permissions?.length) {
13788
+ obj.permissions = message.permissions;
13789
+ }
13790
+ if (message.msgPermissions) {
13791
+ const entries = globalThis.Object.entries(message.msgPermissions);
13792
+ if (entries.length > 0) {
13793
+ obj.msgPermissions = {};
13794
+ entries.forEach(([k, v]) => {
13795
+ obj.msgPermissions[k] = v;
13796
+ });
13797
+ }
13798
+ }
13799
+ if (message.keyManagementMsgs?.length) {
13800
+ obj.keyManagementMsgs = message.keyManagementMsgs;
13801
+ }
13802
+ return obj;
13803
+ },
13804
+ create(base) {
13805
+ return QueryPermissionSchemaResponse.fromPartial(base ?? {});
13806
+ },
13807
+ fromPartial(object) {
13808
+ const message = createBaseQueryPermissionSchemaResponse();
13809
+ message.schemaVersion = object.schemaVersion ?? "";
13810
+ message.permissions = object.permissions?.map((e) => e) || [];
13811
+ message.msgPermissions = globalThis.Object.entries(object.msgPermissions ?? {}).reduce(
13812
+ (acc, [key, value]) => {
13813
+ if (value !== void 0) {
13814
+ acc[key] = globalThis.String(value);
13815
+ }
13816
+ return acc;
13817
+ },
13818
+ {}
13819
+ );
13820
+ message.keyManagementMsgs = object.keyManagementMsgs?.map((e) => e) || [];
13821
+ return message;
13822
+ }
13823
+ };
13824
+ function createBaseQueryPermissionSchemaResponse_MsgPermissionsEntry() {
13825
+ return { key: "", value: "" };
13826
+ }
13827
+ var QueryPermissionSchemaResponse_MsgPermissionsEntry = {
13828
+ encode(message, writer = new BinaryWriter()) {
13829
+ if (message.key !== "") {
13830
+ writer.uint32(10).string(message.key);
13831
+ }
13832
+ if (message.value !== "") {
13833
+ writer.uint32(18).string(message.value);
13834
+ }
13835
+ return writer;
13836
+ },
13837
+ decode(input, length) {
13838
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
13839
+ const end = length === void 0 ? reader.len : reader.pos + length;
13840
+ const message = createBaseQueryPermissionSchemaResponse_MsgPermissionsEntry();
13841
+ while (reader.pos < end) {
13842
+ const tag = reader.uint32();
13843
+ switch (tag >>> 3) {
13844
+ case 1: {
13845
+ if (tag !== 10) {
13846
+ break;
13847
+ }
13848
+ message.key = reader.string();
13849
+ continue;
13850
+ }
13851
+ case 2: {
13852
+ if (tag !== 18) {
13853
+ break;
13854
+ }
13855
+ message.value = reader.string();
13856
+ continue;
13857
+ }
13858
+ }
13859
+ if ((tag & 7) === 4 || tag === 0) {
13860
+ break;
13861
+ }
13862
+ reader.skip(tag & 7);
13863
+ }
13864
+ return message;
13865
+ },
13866
+ fromJSON(object) {
13867
+ return {
13868
+ key: isSet14(object.key) ? globalThis.String(object.key) : "",
13869
+ value: isSet14(object.value) ? globalThis.String(object.value) : ""
13870
+ };
13871
+ },
13872
+ toJSON(message) {
13873
+ const obj = {};
13874
+ if (message.key !== "") {
13875
+ obj.key = message.key;
13876
+ }
13877
+ if (message.value !== "") {
13878
+ obj.value = message.value;
13879
+ }
13880
+ return obj;
13881
+ },
13882
+ create(base) {
13883
+ return QueryPermissionSchemaResponse_MsgPermissionsEntry.fromPartial(base ?? {});
13884
+ },
13885
+ fromPartial(object) {
13886
+ const message = createBaseQueryPermissionSchemaResponse_MsgPermissionsEntry();
13887
+ message.key = object.key ?? "";
13888
+ message.value = object.value ?? "";
13889
+ return message;
13890
+ }
13891
+ };
12773
13892
  var QueryDefinition = {
12774
13893
  name: "Query",
12775
13894
  fullName: "qorechain.abstractaccount.v1.Query",
@@ -12781,7 +13900,53 @@ var QueryDefinition = {
12781
13900
  requestStream: false,
12782
13901
  responseType: QueryConfigResponse,
12783
13902
  responseStream: false,
12784
- options: {}
13903
+ options: {
13904
+ _unknownFields: {
13905
+ 578365826: [
13906
+ new Uint8Array([
13907
+ 38,
13908
+ 18,
13909
+ 36,
13910
+ 47,
13911
+ 113,
13912
+ 111,
13913
+ 114,
13914
+ 101,
13915
+ 99,
13916
+ 104,
13917
+ 97,
13918
+ 105,
13919
+ 110,
13920
+ 47,
13921
+ 97,
13922
+ 98,
13923
+ 115,
13924
+ 116,
13925
+ 114,
13926
+ 97,
13927
+ 99,
13928
+ 116,
13929
+ 97,
13930
+ 99,
13931
+ 99,
13932
+ 111,
13933
+ 117,
13934
+ 110,
13935
+ 116,
13936
+ 47,
13937
+ 118,
13938
+ 49,
13939
+ 47,
13940
+ 99,
13941
+ 111,
13942
+ 110,
13943
+ 102,
13944
+ 105,
13945
+ 103
13946
+ ])
13947
+ ]
13948
+ }
13949
+ }
12785
13950
  },
12786
13951
  /** Account returns a single abstract account by address. */
12787
13952
  account: {
@@ -12790,7 +13955,65 @@ var QueryDefinition = {
12790
13955
  requestStream: false,
12791
13956
  responseType: QueryAccountResponse,
12792
13957
  responseStream: false,
12793
- options: {}
13958
+ options: {
13959
+ _unknownFields: {
13960
+ 578365826: [
13961
+ new Uint8Array([
13962
+ 50,
13963
+ 18,
13964
+ 48,
13965
+ 47,
13966
+ 113,
13967
+ 111,
13968
+ 114,
13969
+ 101,
13970
+ 99,
13971
+ 104,
13972
+ 97,
13973
+ 105,
13974
+ 110,
13975
+ 47,
13976
+ 97,
13977
+ 98,
13978
+ 115,
13979
+ 116,
13980
+ 114,
13981
+ 97,
13982
+ 99,
13983
+ 116,
13984
+ 97,
13985
+ 99,
13986
+ 99,
13987
+ 111,
13988
+ 117,
13989
+ 110,
13990
+ 116,
13991
+ 47,
13992
+ 118,
13993
+ 49,
13994
+ 47,
13995
+ 97,
13996
+ 99,
13997
+ 99,
13998
+ 111,
13999
+ 117,
14000
+ 110,
14001
+ 116,
14002
+ 115,
14003
+ 47,
14004
+ 123,
14005
+ 97,
14006
+ 100,
14007
+ 100,
14008
+ 114,
14009
+ 101,
14010
+ 115,
14011
+ 115,
14012
+ 125
14013
+ ])
14014
+ ]
14015
+ }
14016
+ }
12794
14017
  },
12795
14018
  /** Accounts lists all abstract accounts. */
12796
14019
  accounts: {
@@ -12799,10 +14022,131 @@ var QueryDefinition = {
12799
14022
  requestStream: false,
12800
14023
  responseType: QueryAccountsResponse,
12801
14024
  responseStream: false,
12802
- options: {}
14025
+ options: {
14026
+ _unknownFields: {
14027
+ 578365826: [
14028
+ new Uint8Array([
14029
+ 40,
14030
+ 18,
14031
+ 38,
14032
+ 47,
14033
+ 113,
14034
+ 111,
14035
+ 114,
14036
+ 101,
14037
+ 99,
14038
+ 104,
14039
+ 97,
14040
+ 105,
14041
+ 110,
14042
+ 47,
14043
+ 97,
14044
+ 98,
14045
+ 115,
14046
+ 116,
14047
+ 114,
14048
+ 97,
14049
+ 99,
14050
+ 116,
14051
+ 97,
14052
+ 99,
14053
+ 99,
14054
+ 111,
14055
+ 117,
14056
+ 110,
14057
+ 116,
14058
+ 47,
14059
+ 118,
14060
+ 49,
14061
+ 47,
14062
+ 97,
14063
+ 99,
14064
+ 99,
14065
+ 111,
14066
+ 117,
14067
+ 110,
14068
+ 116,
14069
+ 115
14070
+ ])
14071
+ ]
14072
+ }
14073
+ }
14074
+ },
14075
+ /**
14076
+ * PermissionSchema returns the canonical authenticator permission taxonomy so
14077
+ * clients (QoreX/dashboard/relayer) validate scopes without hardcoding strings
14078
+ * and detect drift via schema_version (v3.1.85).
14079
+ */
14080
+ permissionSchema: {
14081
+ name: "PermissionSchema",
14082
+ requestType: QueryPermissionSchemaRequest,
14083
+ requestStream: false,
14084
+ responseType: QueryPermissionSchemaResponse,
14085
+ responseStream: false,
14086
+ options: {
14087
+ _unknownFields: {
14088
+ 578365826: [
14089
+ new Uint8Array([
14090
+ 49,
14091
+ 18,
14092
+ 47,
14093
+ 47,
14094
+ 113,
14095
+ 111,
14096
+ 114,
14097
+ 101,
14098
+ 99,
14099
+ 104,
14100
+ 97,
14101
+ 105,
14102
+ 110,
14103
+ 47,
14104
+ 97,
14105
+ 98,
14106
+ 115,
14107
+ 116,
14108
+ 114,
14109
+ 97,
14110
+ 99,
14111
+ 116,
14112
+ 97,
14113
+ 99,
14114
+ 99,
14115
+ 111,
14116
+ 117,
14117
+ 110,
14118
+ 116,
14119
+ 47,
14120
+ 118,
14121
+ 49,
14122
+ 47,
14123
+ 112,
14124
+ 101,
14125
+ 114,
14126
+ 109,
14127
+ 105,
14128
+ 115,
14129
+ 115,
14130
+ 105,
14131
+ 111,
14132
+ 110,
14133
+ 95,
14134
+ 115,
14135
+ 99,
14136
+ 104,
14137
+ 101,
14138
+ 109,
14139
+ 97
14140
+ ])
14141
+ ]
14142
+ }
14143
+ }
12803
14144
  }
12804
14145
  }
12805
14146
  };
14147
+ function isObject(value) {
14148
+ return typeof value === "object" && value !== null;
14149
+ }
12806
14150
  function isSet14(value) {
12807
14151
  return value !== null && value !== void 0;
12808
14152
  }
@@ -24017,6 +25361,277 @@ function base64FromBytes11(arr) {
24017
25361
  function isSet26(value) {
24018
25362
  return value !== null && value !== void 0;
24019
25363
  }
25364
+ var enc2 = new TextEncoder();
25365
+ function toBytes3(x) {
25366
+ return typeof x === "string" ? enc2.encode(x) : x;
25367
+ }
25368
+ function hexToBytes3(hex) {
25369
+ const h = hex.replace(/^0x/, "");
25370
+ const out = new Uint8Array(h.length / 2);
25371
+ for (let i = 0; i < out.length; i++) {
25372
+ out[i] = parseInt(h.slice(i * 2, i * 2 + 2), 16);
25373
+ }
25374
+ return out;
25375
+ }
25376
+ function bytesToHex0x(b) {
25377
+ let s = "0x";
25378
+ for (const x of b) s += x.toString(16).padStart(2, "0");
25379
+ return s;
25380
+ }
25381
+ function toHexLower2(b) {
25382
+ let s = "";
25383
+ for (const x of b) s += x.toString(16).padStart(2, "0");
25384
+ return s;
25385
+ }
25386
+ function parseCoins(amount) {
25387
+ const m = /^([0-9]+)([a-zA-Z][a-zA-Z0-9/:._-]*)$/.exec(String(amount).trim());
25388
+ if (!m) {
25389
+ throw new Error(`invalid amount "${amount}" (expected e.g. "100uqor")`);
25390
+ }
25391
+ return [{ denom: m[2], amount: m[1] }];
25392
+ }
25393
+ function executeEvmMsg(input) {
25394
+ const {
25395
+ relayer,
25396
+ account,
25397
+ scheme,
25398
+ pubkey,
25399
+ signature,
25400
+ to = "",
25401
+ value = "0",
25402
+ data = new Uint8Array(0),
25403
+ gasLimit,
25404
+ nonce
25405
+ } = input;
25406
+ return {
25407
+ typeUrl: "/qorechain.abstractaccount.v1.MsgExecuteEVM",
25408
+ value: {
25409
+ relayer,
25410
+ account,
25411
+ scheme,
25412
+ pubkey: toBytes3(pubkey),
25413
+ signature: toBytes3(signature),
25414
+ to,
25415
+ value,
25416
+ data: toBytes3(data),
25417
+ gasLimit: BigInt(gasLimit),
25418
+ nonce: BigInt(nonce)
25419
+ }
25420
+ };
25421
+ }
25422
+ function executeCosmosMsg(input) {
25423
+ const { relayer, account, scheme, pubkey, signature, to, amount, nonce } = input;
25424
+ return {
25425
+ typeUrl: "/qorechain.abstractaccount.v1.MsgExecuteCosmos",
25426
+ value: {
25427
+ relayer,
25428
+ account,
25429
+ scheme,
25430
+ pubkey: toBytes3(pubkey),
25431
+ signature: toBytes3(signature),
25432
+ to,
25433
+ amount: parseCoins(amount),
25434
+ nonce: BigInt(nonce)
25435
+ }
25436
+ };
25437
+ }
25438
+ function revokeAuthenticatorMsg(input) {
25439
+ const { owner, account = owner, scheme, pubkey } = input;
25440
+ return {
25441
+ typeUrl: "/qorechain.abstractaccount.v1.MsgRevokeAuthenticator",
25442
+ value: {
25443
+ owner,
25444
+ accountAddress: account,
25445
+ scheme,
25446
+ pubkey: toBytes3(pubkey)
25447
+ }
25448
+ };
25449
+ }
25450
+ function registerEthAuthenticatorMsg(input) {
25451
+ const {
25452
+ owner,
25453
+ account = owner,
25454
+ ethAddress,
25455
+ permissions = ["evm"],
25456
+ expiryUnix,
25457
+ label = "metamask"
25458
+ } = input;
25459
+ return {
25460
+ typeUrl: "/qorechain.abstractaccount.v1.MsgRegisterAuthenticator",
25461
+ value: {
25462
+ owner,
25463
+ accountAddress: account,
25464
+ scheme: "secp256k1",
25465
+ pubkey: hexToBytes3(ethAddress),
25466
+ permissions,
25467
+ expiryUnix: BigInt(expiryUnix),
25468
+ label
25469
+ }
25470
+ };
25471
+ }
25472
+ function rotatePqcKeyMsg(input) {
25473
+ const { sender, oldPublicKey, newPublicKey, oldSignature, newSignature } = input;
25474
+ return {
25475
+ typeUrl: "/qorechain.pqc.v1.MsgRotatePQCKey",
25476
+ value: {
25477
+ sender,
25478
+ oldPublicKey: toBytes3(oldPublicKey),
25479
+ newPublicKey: toBytes3(newPublicKey),
25480
+ oldSignature: toBytes3(oldSignature),
25481
+ newSignature: toBytes3(newSignature)
25482
+ }
25483
+ };
25484
+ }
25485
+ function walletPubkey(wallet) {
25486
+ const pk = wallet.publicKey;
25487
+ return pk instanceof Uint8Array ? pk : pk.toBytes();
25488
+ }
25489
+ function normalizeSignature(res) {
25490
+ return res instanceof Uint8Array ? res : res.signature;
25491
+ }
25492
+ async function buildPhantomExecuteEvm(opts) {
25493
+ const {
25494
+ wallet,
25495
+ relayer,
25496
+ chainId,
25497
+ account,
25498
+ to = "",
25499
+ value = "0",
25500
+ data = new Uint8Array(0),
25501
+ gasLimit = 1e5,
25502
+ nonce
25503
+ } = opts;
25504
+ const pubkey = walletPubkey(wallet);
25505
+ const digest = evmAuthSignBytes({ chainId, account, pubkey, to, value, data, nonce });
25506
+ const signature = normalizeSignature(await wallet.signMessage(digest));
25507
+ return executeEvmMsg({
25508
+ relayer,
25509
+ account,
25510
+ scheme: "ed25519",
25511
+ pubkey,
25512
+ signature,
25513
+ to,
25514
+ value,
25515
+ data,
25516
+ gasLimit,
25517
+ nonce
25518
+ });
25519
+ }
25520
+ async function buildPhantomExecuteCosmos(opts) {
25521
+ const { wallet, relayer, chainId, account, to, amount, nonce } = opts;
25522
+ const pubkey = walletPubkey(wallet);
25523
+ const digest = cosmosAuthSignBytes({ chainId, account, pubkey, to, amount, nonce });
25524
+ const signature = normalizeSignature(await wallet.signMessage(digest));
25525
+ return executeCosmosMsg({
25526
+ relayer,
25527
+ account,
25528
+ scheme: "ed25519",
25529
+ pubkey,
25530
+ signature,
25531
+ to,
25532
+ amount,
25533
+ nonce
25534
+ });
25535
+ }
25536
+ async function ethPersonalSign(provider, address, digest) {
25537
+ const sigHex = await provider.request({
25538
+ method: "personal_sign",
25539
+ params: [bytesToHex0x(digest), address]
25540
+ });
25541
+ return hexToBytes3(sigHex);
25542
+ }
25543
+ async function buildMetaMaskExecuteEvm(opts) {
25544
+ const {
25545
+ provider,
25546
+ address,
25547
+ relayer,
25548
+ chainId,
25549
+ account,
25550
+ to = "",
25551
+ value = "0",
25552
+ data = new Uint8Array(0),
25553
+ gasLimit = 1e5,
25554
+ nonce
25555
+ } = opts;
25556
+ const pubkey = hexToBytes3(address);
25557
+ const digest = evmAuthSignBytes({ chainId, account, pubkey, to, value, data, nonce });
25558
+ const signature = await ethPersonalSign(provider, address, digest);
25559
+ return executeEvmMsg({
25560
+ relayer,
25561
+ account,
25562
+ scheme: "secp256k1",
25563
+ pubkey,
25564
+ signature,
25565
+ to,
25566
+ value,
25567
+ data,
25568
+ gasLimit,
25569
+ nonce
25570
+ });
25571
+ }
25572
+ async function buildMetaMaskExecuteCosmos(opts) {
25573
+ const { provider, address, relayer, chainId, account, to, amount, nonce } = opts;
25574
+ const pubkey = hexToBytes3(address);
25575
+ const digest = cosmosAuthSignBytes({ chainId, account, pubkey, to, amount, nonce });
25576
+ const signature = await ethPersonalSign(provider, address, digest);
25577
+ return executeCosmosMsg({
25578
+ relayer,
25579
+ account,
25580
+ scheme: "secp256k1",
25581
+ pubkey,
25582
+ signature,
25583
+ to,
25584
+ amount,
25585
+ nonce
25586
+ });
25587
+ }
25588
+ var CANONICAL_DERIVATION = "adapter";
25589
+ var LEGACY_DERIVATION = "bridge";
25590
+ function derivePqcLegacy(mnemonic) {
25591
+ return generatePqcKeypair(shake256(enc2.encode(mnemonic), 32));
25592
+ }
25593
+ function derivePqcCanonical(account, mnemonic) {
25594
+ return generatePqcKeypair(
25595
+ shake256(enc2.encode(`qorechain:pqc:v1|${account}|${mnemonic}`), 32)
25596
+ );
25597
+ }
25598
+ function derivePqcByScheme(scheme, account, mnemonic) {
25599
+ if (scheme === LEGACY_DERIVATION || scheme === "mnemonic-only") {
25600
+ return derivePqcLegacy(mnemonic);
25601
+ }
25602
+ if (scheme === CANONICAL_DERIVATION || scheme === "") {
25603
+ return derivePqcCanonical(account, mnemonic);
25604
+ }
25605
+ throw new Error(`unknown derivation "${scheme}" (use adapter|bridge)`);
25606
+ }
25607
+ function rotatePqcKeyMsgFromMnemonic(opts) {
25608
+ const {
25609
+ account,
25610
+ mnemonic,
25611
+ chainId,
25612
+ algorithmId = 1,
25613
+ oldDerivation = LEGACY_DERIVATION,
25614
+ newDerivation = CANONICAL_DERIVATION
25615
+ } = opts;
25616
+ const oldKp = derivePqcByScheme(oldDerivation, account, mnemonic);
25617
+ const newKp = derivePqcByScheme(newDerivation, account, mnemonic);
25618
+ if (toHexLower2(oldKp.publicKey) === toHexLower2(newKp.publicKey)) {
25619
+ throw new Error(
25620
+ "old and new derivations produce the same key \u2014 rotation would be a no-op"
25621
+ );
25622
+ }
25623
+ const sb = enc2.encode(
25624
+ rotationSignBytes(chainId, algorithmId, account, oldKp.publicKey, newKp.publicKey)
25625
+ );
25626
+ const msg2 = rotatePqcKeyMsg({
25627
+ sender: account,
25628
+ oldPublicKey: oldKp.publicKey,
25629
+ newPublicKey: newKp.publicKey,
25630
+ oldSignature: mldsa.sign(oldKp.secretKey, sb),
25631
+ newSignature: mldsa.sign(newKp.secretKey, sb)
25632
+ });
25633
+ return { msg: msg2, oldKeypair: oldKp, newKeypair: newKp };
25634
+ }
24020
25635
 
24021
25636
  // src/wallet/cosmos.ts
24022
25637
  function suggestChainInfo(network) {
@@ -24105,6 +25720,13 @@ function createQueryClients(rpc) {
24105
25720
  "Accounts",
24106
25721
  QueryAccountsRequest,
24107
25722
  QueryAccountsResponse
25723
+ ),
25724
+ permissionSchema: unary(
25725
+ rpc,
25726
+ "qorechain.abstractaccount.v1.Query",
25727
+ "PermissionSchema",
25728
+ QueryPermissionSchemaRequest,
25729
+ QueryPermissionSchemaResponse
24108
25730
  )
24109
25731
  },
24110
25732
  amm: {
@@ -24821,8 +26443,8 @@ async function migrateToHybrid(tx, opts) {
24821
26443
  }
24822
26444
 
24823
26445
  // src/index.ts
24824
- var VERSION = "0.6.1";
26446
+ var VERSION = "0.7.0";
24825
26447
 
24826
- export { AlgorithmDilithium5, AlgorithmMLKEM1024, AlgorithmUnspecified, DEFAULT_GAS_MULTIPLIER, DEFAULT_GAS_PRICE, ETHSECP256K1_PUBKEY_TYPE, EthNativeSigner, GasPrice, HYBRID_SIG_TYPE_URL, HybridSigner, JsonRpcClient, JsonRpcError, ML_DSA_87_PUBLIC_KEY_LENGTH, ML_DSA_87_SECRET_KEY_LENGTH, ML_DSA_87_SEED_LENGTH, ML_DSA_87_SIGNATURE_LENGTH, MSG_SEND_TYPE_URL, NETWORKS, PHANTOM_DERIVATION_DOMAIN, PQC_KEY_STATUS_PRECOMPILE_ADDRESS, PqcSigner, QorClient, QoreHttpError, QoreTxError, RestClient, STATIC_FALLBACK, TxClient, VERSION, VM_TYPES, abstractaccount, accountAuthInfo, addressesFrom20, algorithmName, amm, attachHybridExtension, authz, bank, bech32ToHex, bridge, broadcastAndWait, buildAminoTypes, buildEventsQuery, buildHybridSignatureExtension, buildHybridTx, buildRegisterPqcKeyMsg, buildTxQuery, buildUrl, bytesToBech32, calculateFee, clearAdmin, connectCosmWasmSigner, connectPhantomUnified, connectQueryClients, createClient, createCosmWasmClient, createCrossVMClient, createMultilayerClient, createQueryClients, createRollupClient, createSubscriptionClient, crossvm, decodeTxError, deriveEvmAccount, deriveNativeAccount, deriveSvmAccount, deriveUnifiedAccount, directSignerFromPrivateKey, distribution, encodeHybridExtension, ensurePqcRegistered, estimateFee, evmToQor, execute, explorerAddressUrl, explorerBlockUrl, explorerTxUrl, feegrant, formatUnits, fromBase, generateMnemonic, generatePqcKeypair, getBlock, getCodeDetails, getCodes, getContractInfo, getContracts, getCosmosWallet, getCrossVmMessage, getCrossVmParams, getJson, getLatestBlock, getNetwork, getPendingCrossVmMessages, getPqcStatus, getTx, gov, hexToBech32, ibc, instantiate, instantiate2, isChecksumAddress, isPqcRegistered, isSignatureAlgorithm, isTxFailure, isValidBech32, isValidEvmAddress, isValidSvmAddress, joinUrl, keccak256, keccak256Hex, license, lightnode, listNetworks, migrate, migratePqcKey, migrateToHybrid, msg, multilayer, parseEthPubkeyAny, parseUnits, postJsonRpc, pqc as pqcMsg, pqcSign, pqcVerify, qorToEvm, qoreAddresses, qorechainRegistry, qorechainRegistryTypes, codegen_exports as qorechainTypes, queryContractSmart, rdk, requestFaucet, ripemd160, ripemd160Hex, rlconsensus, searchTxs, sha256, sha256Hex, signAndBroadcastHybrid, signClassicalEth, signHybridEth, staking, subscribeNewBlocks, subscribeTx, suggestChainInfo, svm, toBase, toChecksumAddress, toHex, txErrorFrom, unifiedAccountFromPhantomSignature, unifiedAccountFromSeed, updateAdmin, uploadCode, validateMnemonic, waitForTx, withRetry2 as withRetry };
26448
+ export { AlgorithmDilithium5, AlgorithmMLKEM1024, AlgorithmUnspecified, CANONICAL_DERIVATION, DEFAULT_GAS_MULTIPLIER, DEFAULT_GAS_PRICE, ETHSECP256K1_PUBKEY_TYPE, EthNativeSigner, GasPrice, HYBRID_SIG_TYPE_URL, HybridSigner, JsonRpcClient, JsonRpcError, LEGACY_DERIVATION, ML_DSA_87_PUBLIC_KEY_LENGTH, ML_DSA_87_SECRET_KEY_LENGTH, ML_DSA_87_SEED_LENGTH, ML_DSA_87_SIGNATURE_LENGTH, MSG_SEND_TYPE_URL, NETWORKS, PHANTOM_DERIVATION_DOMAIN, PQC_KEY_STATUS_PRECOMPILE_ADDRESS, PqcSigner, QorClient, QoreHttpError, QoreTxError, RestClient, STATIC_FALLBACK, TxClient, VERSION, VM_TYPES, abstractaccount, accountAuthInfo, addressesFrom20, algorithmName, amm, attachHybridExtension, authz, bank, be64, bech32ToHex, bridge, broadcastAndWait, buildAminoTypes, buildEventsQuery, buildHybridSignatureExtension, buildHybridTx, buildMetaMaskExecuteCosmos, buildMetaMaskExecuteEvm, buildPhantomExecuteCosmos, buildPhantomExecuteEvm, buildRegisterPqcKeyMsg, buildTxQuery, buildUrl, bytesToBech32, calculateFee, clearAdmin, connectCosmWasmSigner, connectPhantomUnified, connectQueryClients, cosmosAuthSignBytes, createClient, createCosmWasmClient, createCrossVMClient, createMultilayerClient, createQueryClients, createRollupClient, createSubscriptionClient, crossvm, decodeTxError, deriveEvmAccount, deriveNativeAccount, derivePqcLegacy, deriveSvmAccount, deriveUnifiedAccount, directSignerFromPrivateKey, distribution, encodeHybridExtension, ensurePqcRegistered, estimateFee, evmAuthSignBytes, evmToQor, execute, executeCosmosMsg, executeEvmMsg, explorerAddressUrl, explorerBlockUrl, explorerTxUrl, feegrant, formatUnits, fromBase, generateMnemonic, generatePqcKeypair, getBlock, getCodeDetails, getCodes, getContractInfo, getContracts, getCosmosWallet, getCrossVmMessage, getCrossVmParams, getJson, getLatestBlock, getNetwork, getPendingCrossVmMessages, getPqcStatus, getTx, gov, hexToBech32, ibc, instantiate, instantiate2, isChecksumAddress, isPqcRegistered, isSignatureAlgorithm, isTxFailure, isValidBech32, isValidEvmAddress, isValidSvmAddress, joinUrl, keccak256, keccak256Hex, lengthPrefixed, license, lightnode, listNetworks, migrate, migratePqcKey, migrateToHybrid, msg, multilayer, parseEthPubkeyAny, parseUnits, postJsonRpc, pqc as pqcMsg, pqcSign, pqcVerify, qorToEvm, qoreAddresses, qorechainRegistry, qorechainRegistryTypes, codegen_exports as qorechainTypes, queryContractSmart, rdk, registerEthAuthenticatorMsg, requestFaucet, revokeAuthenticatorMsg, ripemd160, ripemd160Hex, rlconsensus, rotatePqcKeyMsg, rotatePqcKeyMsgFromMnemonic, rotationSignBytes, searchTxs, sha256, sha256Hex, signAndBroadcastHybrid, signClassicalEth, signHybridEth, staking, subscribeNewBlocks, subscribeTx, suggestChainInfo, svm, toBase, toChecksumAddress, toHex, txErrorFrom, unifiedAccountFromPhantomSignature, unifiedAccountFromSeed, updateAdmin, uploadCode, validateMnemonic, waitForTx, withRetry2 as withRetry };
24827
26449
  //# sourceMappingURL=index.js.map
24828
26450
  //# sourceMappingURL=index.js.map