@onekeyfe/hd-web-sdk 0.2.10 → 0.2.12

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.
@@ -7482,6 +7482,11 @@ const inject = ({
7482
7482
  connectId,
7483
7483
  deviceId,
7484
7484
  method: 'cardanoSignTransaction'
7485
+ })),
7486
+ cardanoSignMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), {
7487
+ connectId,
7488
+ deviceId,
7489
+ method: 'cardanoSignMessage'
7485
7490
  }))
7486
7491
  };
7487
7492
  return api;
@@ -9979,6 +9984,12 @@ var nested = {
9979
9984
  POLICY_ID: 2
9980
9985
  }
9981
9986
  },
9987
+ CardanoTxOutputSerializationFormat: {
9988
+ values: {
9989
+ ARRAY_LEGACY: 0,
9990
+ MAP_BABBAGE: 1
9991
+ }
9992
+ },
9982
9993
  CardanoCertificateType: {
9983
9994
  values: {
9984
9995
  STAKE_REGISTRATION: 0,
@@ -9997,14 +10008,21 @@ var nested = {
9997
10008
  CardanoTxAuxiliaryDataSupplementType: {
9998
10009
  values: {
9999
10010
  NONE: 0,
10000
- CATALYST_REGISTRATION_SIGNATURE: 1
10011
+ GOVERNANCE_REGISTRATION_SIGNATURE: 1
10012
+ }
10013
+ },
10014
+ CardanoGovernanceRegistrationFormat: {
10015
+ values: {
10016
+ CIP15: 0,
10017
+ CIP36: 1
10001
10018
  }
10002
10019
  },
10003
10020
  CardanoTxSigningMode: {
10004
10021
  values: {
10005
10022
  ORDINARY_TRANSACTION: 0,
10006
10023
  POOL_REGISTRATION_AS_OWNER: 1,
10007
- MULTISIG_TRANSACTION: 2
10024
+ MULTISIG_TRANSACTION: 2,
10025
+ PLUTUS_TRANSACTION: 3
10008
10026
  }
10009
10027
  },
10010
10028
  CardanoTxWitnessType: {
@@ -10358,6 +10376,31 @@ var nested = {
10358
10376
  rule: "required",
10359
10377
  type: "uint32",
10360
10378
  id: 4
10379
+ },
10380
+ datum_hash: {
10381
+ type: "bytes",
10382
+ id: 5
10383
+ },
10384
+ format: {
10385
+ type: "CardanoTxOutputSerializationFormat",
10386
+ id: 6,
10387
+ options: {
10388
+ "default": "ARRAY_LEGACY"
10389
+ }
10390
+ },
10391
+ inline_datum_size: {
10392
+ type: "uint32",
10393
+ id: 7,
10394
+ options: {
10395
+ "default": 0
10396
+ }
10397
+ },
10398
+ reference_script_size: {
10399
+ type: "uint32",
10400
+ id: 8,
10401
+ options: {
10402
+ "default": 0
10403
+ }
10361
10404
  }
10362
10405
  }
10363
10406
  },
@@ -10392,6 +10435,24 @@ var nested = {
10392
10435
  }
10393
10436
  }
10394
10437
  },
10438
+ CardanoTxInlineDatumChunk: {
10439
+ fields: {
10440
+ data: {
10441
+ rule: "required",
10442
+ type: "bytes",
10443
+ id: 1
10444
+ }
10445
+ }
10446
+ },
10447
+ CardanoTxReferenceScriptChunk: {
10448
+ fields: {
10449
+ data: {
10450
+ rule: "required",
10451
+ type: "bytes",
10452
+ id: 1
10453
+ }
10454
+ }
10455
+ },
10395
10456
  CardanoPoolOwner: {
10396
10457
  fields: {
10397
10458
  staking_key_path: {
@@ -10484,22 +10545,6 @@ var nested = {
10484
10545
  type: "string",
10485
10546
  id: 7
10486
10547
  },
10487
- owners: {
10488
- rule: "repeated",
10489
- type: "CardanoPoolOwner",
10490
- id: 8,
10491
- options: {
10492
- deprecated: true
10493
- }
10494
- },
10495
- relays: {
10496
- rule: "repeated",
10497
- type: "CardanoPoolRelayParameters",
10498
- id: 9,
10499
- options: {
10500
- deprecated: true
10501
- }
10502
- },
10503
10548
  metadata: {
10504
10549
  type: "CardanoPoolMetadataType",
10505
10550
  id: 10
@@ -10542,6 +10587,10 @@ var nested = {
10542
10587
  script_hash: {
10543
10588
  type: "bytes",
10544
10589
  id: 5
10590
+ },
10591
+ key_hash: {
10592
+ type: "bytes",
10593
+ id: 6
10545
10594
  }
10546
10595
  }
10547
10596
  },
@@ -10563,16 +10612,33 @@ var nested = {
10563
10612
  script_hash: {
10564
10613
  type: "bytes",
10565
10614
  id: 3
10615
+ },
10616
+ key_hash: {
10617
+ type: "bytes",
10618
+ id: 4
10566
10619
  }
10567
10620
  }
10568
10621
  },
10569
- CardanoCatalystRegistrationParametersType: {
10622
+ CardanoGovernanceRegistrationDelegation: {
10570
10623
  fields: {
10571
10624
  voting_public_key: {
10572
10625
  rule: "required",
10573
10626
  type: "bytes",
10574
10627
  id: 1
10575
10628
  },
10629
+ weight: {
10630
+ rule: "required",
10631
+ type: "uint32",
10632
+ id: 2
10633
+ }
10634
+ }
10635
+ },
10636
+ CardanoGovernanceRegistrationParametersType: {
10637
+ fields: {
10638
+ voting_public_key: {
10639
+ type: "bytes",
10640
+ id: 1
10641
+ },
10576
10642
  staking_path: {
10577
10643
  rule: "repeated",
10578
10644
  type: "uint32",
@@ -10590,13 +10656,29 @@ var nested = {
10590
10656
  rule: "required",
10591
10657
  type: "uint64",
10592
10658
  id: 4
10659
+ },
10660
+ format: {
10661
+ type: "CardanoGovernanceRegistrationFormat",
10662
+ id: 5,
10663
+ options: {
10664
+ "default": "CIP15"
10665
+ }
10666
+ },
10667
+ delegations: {
10668
+ rule: "repeated",
10669
+ type: "CardanoGovernanceRegistrationDelegation",
10670
+ id: 6
10671
+ },
10672
+ voting_purpose: {
10673
+ type: "uint64",
10674
+ id: 7
10593
10675
  }
10594
10676
  }
10595
10677
  },
10596
10678
  CardanoTxAuxiliaryData: {
10597
10679
  fields: {
10598
- catalyst_registration_parameters: {
10599
- type: "CardanoCatalystRegistrationParametersType",
10680
+ governance_registration_parameters: {
10681
+ type: "CardanoGovernanceRegistrationParametersType",
10600
10682
  id: 1
10601
10683
  },
10602
10684
  hash: {
@@ -10614,6 +10696,50 @@ var nested = {
10614
10696
  }
10615
10697
  }
10616
10698
  },
10699
+ CardanoTxCollateralInput: {
10700
+ fields: {
10701
+ prev_hash: {
10702
+ rule: "required",
10703
+ type: "bytes",
10704
+ id: 1
10705
+ },
10706
+ prev_index: {
10707
+ rule: "required",
10708
+ type: "uint32",
10709
+ id: 2
10710
+ }
10711
+ }
10712
+ },
10713
+ CardanoTxRequiredSigner: {
10714
+ fields: {
10715
+ key_hash: {
10716
+ type: "bytes",
10717
+ id: 1
10718
+ },
10719
+ key_path: {
10720
+ rule: "repeated",
10721
+ type: "uint32",
10722
+ id: 2,
10723
+ options: {
10724
+ packed: false
10725
+ }
10726
+ }
10727
+ }
10728
+ },
10729
+ CardanoTxReferenceInput: {
10730
+ fields: {
10731
+ prev_hash: {
10732
+ rule: "required",
10733
+ type: "bytes",
10734
+ id: 1
10735
+ },
10736
+ prev_index: {
10737
+ rule: "required",
10738
+ type: "uint32",
10739
+ id: 2
10740
+ }
10741
+ }
10742
+ },
10617
10743
  CardanoTxItemAck: {
10618
10744
  fields: {}
10619
10745
  },
@@ -10628,7 +10754,7 @@ var nested = {
10628
10754
  type: "bytes",
10629
10755
  id: 2
10630
10756
  },
10631
- catalyst_signature: {
10757
+ governance_signature: {
10632
10758
  type: "bytes",
10633
10759
  id: 3
10634
10760
  }
@@ -10684,258 +10810,42 @@ var nested = {
10684
10810
  CardanoSignTxFinished: {
10685
10811
  fields: {}
10686
10812
  },
10687
- CardanoSignTx: {
10688
- options: {
10689
- deprecated: true
10690
- },
10813
+ CardanoSignMessage: {
10691
10814
  fields: {
10692
- inputs: {
10693
- rule: "repeated",
10694
- type: "CardanoTxInputType",
10695
- id: 1
10696
- },
10697
- outputs: {
10815
+ address_n: {
10698
10816
  rule: "repeated",
10699
- type: "CardanoTxOutputType",
10700
- id: 2
10701
- },
10702
- protocol_magic: {
10703
- rule: "required",
10704
10817
  type: "uint32",
10705
- id: 5
10818
+ id: 1,
10819
+ options: {
10820
+ packed: false
10821
+ }
10706
10822
  },
10707
- fee: {
10823
+ message: {
10708
10824
  rule: "required",
10709
- type: "uint64",
10710
- id: 6
10825
+ type: "bytes",
10826
+ id: 2
10711
10827
  },
10712
- ttl: {
10713
- type: "uint64",
10714
- id: 7
10828
+ derivation_type: {
10829
+ rule: "required",
10830
+ type: "CardanoDerivationType",
10831
+ id: 3
10715
10832
  },
10716
10833
  network_id: {
10717
10834
  rule: "required",
10718
10835
  type: "uint32",
10719
- id: 8
10720
- },
10721
- certificates: {
10722
- rule: "repeated",
10723
- type: "CardanoTxCertificateType",
10724
- id: 9
10725
- },
10726
- withdrawals: {
10727
- rule: "repeated",
10728
- type: "CardanoTxWithdrawalType",
10729
- id: 10
10730
- },
10731
- validity_interval_start: {
10732
- type: "uint64",
10733
- id: 12
10734
- },
10735
- auxiliary_data: {
10736
- type: "CardanoTxAuxiliaryDataType",
10737
- id: 13
10738
- }
10739
- },
10740
- nested: {
10741
- CardanoTxInputType: {
10742
- fields: {
10743
- address_n: {
10744
- rule: "repeated",
10745
- type: "uint32",
10746
- id: 1,
10747
- options: {
10748
- packed: false
10749
- }
10750
- },
10751
- prev_hash: {
10752
- rule: "required",
10753
- type: "bytes",
10754
- id: 2
10755
- },
10756
- prev_index: {
10757
- rule: "required",
10758
- type: "uint32",
10759
- id: 3
10760
- }
10761
- }
10762
- },
10763
- CardanoTxOutputType: {
10764
- fields: {
10765
- address: {
10766
- type: "string",
10767
- id: 1
10768
- },
10769
- amount: {
10770
- rule: "required",
10771
- type: "uint64",
10772
- id: 3
10773
- },
10774
- address_parameters: {
10775
- type: "CardanoAddressParametersType",
10776
- id: 4
10777
- },
10778
- token_bundle: {
10779
- rule: "repeated",
10780
- type: "CardanoAssetGroupType",
10781
- id: 5
10782
- }
10783
- }
10784
- },
10785
- CardanoAssetGroupType: {
10786
- fields: {
10787
- policy_id: {
10788
- rule: "required",
10789
- type: "bytes",
10790
- id: 1
10791
- },
10792
- tokens: {
10793
- rule: "repeated",
10794
- type: "CardanoTokenType",
10795
- id: 2
10796
- }
10797
- }
10798
- },
10799
- CardanoTokenType: {
10800
- fields: {
10801
- asset_name_bytes: {
10802
- rule: "required",
10803
- type: "bytes",
10804
- id: 1
10805
- },
10806
- amount: {
10807
- rule: "required",
10808
- type: "uint64",
10809
- id: 2
10810
- }
10811
- }
10812
- },
10813
- CardanoPoolOwnerType: {
10814
- fields: {
10815
- staking_key_path: {
10816
- rule: "repeated",
10817
- type: "uint32",
10818
- id: 1,
10819
- options: {
10820
- packed: false
10821
- }
10822
- },
10823
- staking_key_hash: {
10824
- type: "bytes",
10825
- id: 2
10826
- }
10827
- }
10828
- },
10829
- CardanoPoolRelayParametersType: {
10830
- fields: {
10831
- type: {
10832
- rule: "required",
10833
- type: "CardanoPoolRelayType",
10834
- id: 1
10835
- },
10836
- ipv4_address: {
10837
- type: "bytes",
10838
- id: 2
10839
- },
10840
- ipv6_address: {
10841
- type: "bytes",
10842
- id: 3
10843
- },
10844
- host_name: {
10845
- type: "string",
10846
- id: 4
10847
- },
10848
- port: {
10849
- type: "uint32",
10850
- id: 5
10851
- }
10852
- }
10853
- },
10854
- CardanoTxCertificateType: {
10855
- fields: {
10856
- type: {
10857
- rule: "required",
10858
- type: "CardanoCertificateType",
10859
- id: 1
10860
- },
10861
- path: {
10862
- rule: "repeated",
10863
- type: "uint32",
10864
- id: 2,
10865
- options: {
10866
- packed: false
10867
- }
10868
- },
10869
- pool: {
10870
- type: "bytes",
10871
- id: 3
10872
- },
10873
- pool_parameters: {
10874
- type: "CardanoPoolParametersType",
10875
- id: 4
10876
- }
10877
- }
10878
- },
10879
- CardanoTxWithdrawalType: {
10880
- fields: {
10881
- path: {
10882
- rule: "repeated",
10883
- type: "uint32",
10884
- id: 1,
10885
- options: {
10886
- packed: false
10887
- }
10888
- },
10889
- amount: {
10890
- rule: "required",
10891
- type: "uint64",
10892
- id: 2
10893
- }
10894
- }
10895
- },
10896
- CardanoTxAuxiliaryDataType: {
10897
- fields: {
10898
- blob: {
10899
- type: "bytes",
10900
- id: 1
10901
- },
10902
- catalyst_registration_parameters: {
10903
- type: "CardanoCatalystRegistrationParametersType",
10904
- id: 2
10905
- }
10906
- }
10907
- }
10908
- }
10909
- },
10910
- CardanoSignedTxChunk: {
10911
- options: {
10912
- deprecated: true
10913
- },
10914
- fields: {
10915
- signed_tx_chunk: {
10916
- rule: "required",
10917
- type: "bytes",
10918
- id: 1
10836
+ id: 4
10919
10837
  }
10920
10838
  }
10921
10839
  },
10922
- CardanoSignedTxChunkAck: {
10923
- options: {
10924
- deprecated: true
10925
- },
10926
- fields: {}
10927
- },
10928
- CardanoSignedTx: {
10929
- options: {
10930
- deprecated: true
10931
- },
10840
+ CardanoMessageSignature: {
10932
10841
  fields: {
10933
- tx_hash: {
10842
+ signature: {
10934
10843
  rule: "required",
10935
10844
  type: "bytes",
10936
10845
  id: 1
10937
10846
  },
10938
- serialized_tx: {
10847
+ key: {
10848
+ rule: "required",
10939
10849
  type: "bytes",
10940
10850
  id: 2
10941
10851
  }
@@ -13827,11 +13737,16 @@ var nested = {
13827
13737
  zoom_data_length: {
13828
13738
  rule: "required",
13829
13739
  type: "uint32",
13740
+ id: 4
13741
+ },
13742
+ file_name_no_ext: {
13743
+ rule: "required",
13744
+ type: "string",
13830
13745
  id: 5
13831
13746
  },
13832
- nft_meta_data: {
13747
+ nft_metadata: {
13833
13748
  type: "bytes",
13834
- id: 4
13749
+ id: 6
13835
13750
  }
13836
13751
  },
13837
13752
  nested: {
@@ -17032,14 +16947,10 @@ var nested = {
17032
16947
  MessageType_StellarManageBuyOfferOp: 222,
17033
16948
  MessageType_StellarPathPaymentStrictSendOp: 223,
17034
16949
  MessageType_StellarSignedTx: 230,
17035
- MessageType_CardanoSignTx: 303,
17036
16950
  MessageType_CardanoGetPublicKey: 305,
17037
16951
  MessageType_CardanoPublicKey: 306,
17038
16952
  MessageType_CardanoGetAddress: 307,
17039
16953
  MessageType_CardanoAddress: 308,
17040
- MessageType_CardanoSignedTx: 310,
17041
- MessageType_CardanoSignedTxChunk: 311,
17042
- MessageType_CardanoSignedTxChunkAck: 312,
17043
16954
  MessageType_CardanoTxItemAck: 313,
17044
16955
  MessageType_CardanoTxAuxiliaryDataSupplement: 314,
17045
16956
  MessageType_CardanoTxWitnessRequest: 315,
@@ -17060,6 +16971,13 @@ var nested = {
17060
16971
  MessageType_CardanoGetNativeScriptHash: 330,
17061
16972
  MessageType_CardanoNativeScriptHash: 331,
17062
16973
  MessageType_CardanoTxMint: 332,
16974
+ MessageType_CardanoTxCollateralInput: 333,
16975
+ MessageType_CardanoTxRequiredSigner: 334,
16976
+ MessageType_CardanoTxInlineDatumChunk: 335,
16977
+ MessageType_CardanoTxReferenceScriptChunk: 336,
16978
+ MessageType_CardanoTxReferenceInput: 337,
16979
+ MessageType_CardanoSignMessage: 350,
16980
+ MessageType_CardanoMessageSignature: 351,
17063
16981
  MessageType_RippleGetAddress: 400,
17064
16982
  MessageType_RippleAddress: 401,
17065
16983
  MessageType_RippleSignTx: 402,
@@ -20594,6 +20512,9 @@ class DeviceUploadResource extends BaseMethod {
20594
20512
  }, {
20595
20513
  name: 'nftMetaData',
20596
20514
  type: 'string'
20515
+ }, {
20516
+ name: 'file_name_no_ext',
20517
+ type: 'boolean'
20597
20518
  }]);
20598
20519
  const {
20599
20520
  suffix,
@@ -20611,7 +20532,8 @@ class DeviceUploadResource extends BaseMethod {
20611
20532
  data_length: this.paramsData.data.byteLength,
20612
20533
  zoom_data_length: this.paramsData.thumbnailData.byteLength,
20613
20534
  res_type: resType,
20614
- nft_meta_data: nftMetaData
20535
+ nft_metadata: nftMetaData,
20536
+ file_name_no_ext: this.payload.file_name_no_ext
20615
20537
  };
20616
20538
  }
20617
20539
 
@@ -25971,12 +25893,20 @@ class CardanoGetAddress extends BaseMethod {
25971
25893
  address: batch.address,
25972
25894
  protocol_magic: batch.protocolMagic,
25973
25895
  network_id: batch.networkId,
25974
- derivation_type: typeof batch.derivationType !== 'undefined' ? batch.derivationType : hdTransport.Messages.CardanoDerivationType.ICARUS_TREZOR,
25896
+ derivation_type: typeof batch.derivationType !== 'undefined' ? batch.derivationType : hdTransport.Messages.CardanoDerivationType.ICARUS,
25975
25897
  show_display: typeof batch.showOnOneKey === 'boolean' ? !!batch.showOnOneKey : true
25976
25898
  };
25977
25899
  });
25978
25900
  }
25979
25901
 
25902
+ getVersionRange() {
25903
+ return {
25904
+ model_mini: {
25905
+ min: '2.10.0'
25906
+ }
25907
+ };
25908
+ }
25909
+
25980
25910
  run() {
25981
25911
  return __awaiter(this, void 0, void 0, function* () {
25982
25912
  const responses = [];
@@ -26066,12 +25996,20 @@ class CardanoGetPublicKey extends BaseMethod {
26066
25996
  const path = validatePath(batch.path, 3);
26067
25997
  return {
26068
25998
  address_n: path,
26069
- derivation_type: typeof batch.derivationType !== 'undefined' ? batch.derivationType : hdTransport.Messages.CardanoDerivationType.ICARUS_TREZOR,
25999
+ derivation_type: typeof batch.derivationType !== 'undefined' ? batch.derivationType : hdTransport.Messages.CardanoDerivationType.ICARUS,
26070
26000
  show_display: typeof batch.showOnOneKey === 'boolean' ? batch.showOnOneKey : false
26071
26001
  };
26072
26002
  });
26073
26003
  }
26074
26004
 
26005
+ getVersionRange() {
26006
+ return {
26007
+ model_mini: {
26008
+ min: '2.10.0'
26009
+ }
26010
+ };
26011
+ }
26012
+
26075
26013
  run() {
26076
26014
  return __awaiter(this, void 0, void 0, function* () {
26077
26015
  const responses = [];
@@ -26649,6 +26587,14 @@ const gatherWitnessPaths = (inputsWithPath, certificatesWithPoolOwnersAndRelays,
26649
26587
  };
26650
26588
 
26651
26589
  class CardanoSignTransaction extends BaseMethod {
26590
+ getVersionRange() {
26591
+ return {
26592
+ model_mini: {
26593
+ min: '2.10.0'
26594
+ }
26595
+ };
26596
+ }
26597
+
26652
26598
  init() {
26653
26599
  var _a;
26654
26600
 
@@ -26829,7 +26775,7 @@ class CardanoSignTransaction extends BaseMethod {
26829
26775
  networkId: payload.networkId,
26830
26776
  witnessPaths: gatherWitnessPaths(inputsWithPath, certificatesWithPoolOwnersAndRelays, withdrawals, collateralInputsWithPath, requiredSigners, additionalWitnessRequests, payload.signingMode),
26831
26777
  additionalWitnessRequests,
26832
- derivationType: typeof payload.derivationType !== 'undefined' ? payload.derivationType : hdTransport.Messages.CardanoDerivationType.ICARUS_TREZOR,
26778
+ derivationType: typeof payload.derivationType !== 'undefined' ? payload.derivationType : hdTransport.Messages.CardanoDerivationType.ICARUS,
26833
26779
  includeNetworkId: payload.includeNetworkId
26834
26780
  };
26835
26781
  }
@@ -26989,6 +26935,55 @@ class CardanoSignTransaction extends BaseMethod {
26989
26935
 
26990
26936
  }
26991
26937
 
26938
+ class CardanoSignMessage extends BaseMethod {
26939
+ init() {
26940
+ this.checkDeviceId = true;
26941
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.INITIALIZE];
26942
+ const {
26943
+ payload
26944
+ } = this;
26945
+ validateParams(payload, [{
26946
+ name: 'path',
26947
+ type: 'string',
26948
+ required: true
26949
+ }, {
26950
+ name: 'message',
26951
+ type: 'string',
26952
+ required: true
26953
+ }, {
26954
+ name: 'derivationType',
26955
+ type: 'number'
26956
+ }, {
26957
+ name: 'networkId',
26958
+ type: 'number',
26959
+ required: true
26960
+ }]);
26961
+ const addressN = validatePath(payload.path, 3);
26962
+ this.params = {
26963
+ address_n: addressN,
26964
+ message: payload.message,
26965
+ derivation_type: typeof payload.derivationType !== 'undefined' ? payload.derivationType : hdTransport.Messages.CardanoDerivationType.ICARUS,
26966
+ network_id: payload.networkId
26967
+ };
26968
+ }
26969
+
26970
+ getVersionRange() {
26971
+ return {
26972
+ model_mini: {
26973
+ min: '2.10.0'
26974
+ }
26975
+ };
26976
+ }
26977
+
26978
+ run() {
26979
+ return __awaiter(this, void 0, void 0, function* () {
26980
+ const res = yield this.device.commands.typedCall('CardanoSignMessage', 'CardanoMessageSignature', this.params);
26981
+ return res.message;
26982
+ });
26983
+ }
26984
+
26985
+ }
26986
+
26992
26987
  var ApiMethods = /*#__PURE__*/Object.freeze({
26993
26988
  __proto__: null,
26994
26989
  searchDevices: SearchDevices,
@@ -27064,7 +27059,8 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
27064
27059
  suiSignTransaction: SuiSignTransaction,
27065
27060
  cardanoGetAddress: CardanoGetAddress,
27066
27061
  cardanoGetPublicKey: CardanoGetPublicKey,
27067
- cardanoSignTransaction: CardanoSignTransaction
27062
+ cardanoSignTransaction: CardanoSignTransaction,
27063
+ cardanoSignMessage: CardanoSignMessage
27068
27064
  });
27069
27065
 
27070
27066
  function findMethod(message) {
@@ -27933,6 +27929,7 @@ __webpack_unused_export__ = getEnv;
27933
27929
  __webpack_unused_export__ = getHDPath;
27934
27930
  __webpack_unused_export__ = getLog;
27935
27931
  exports.jl = getLogger;
27932
+ __webpack_unused_export__ = getOutputScriptType;
27936
27933
  __webpack_unused_export__ = getSDKVersion;
27937
27934
  __webpack_unused_export__ = getScriptType;
27938
27935
  __webpack_unused_export__ = getTimeStamp;
@@ -28596,6 +28593,13 @@ exports.CardanoNativeScriptHashDisplayFormat = void 0;
28596
28593
  CardanoNativeScriptHashDisplayFormat[CardanoNativeScriptHashDisplayFormat["POLICY_ID"] = 2] = "POLICY_ID";
28597
28594
  })(exports.CardanoNativeScriptHashDisplayFormat || (exports.CardanoNativeScriptHashDisplayFormat = {}));
28598
28595
 
28596
+ exports.CardanoTxOutputSerializationFormat = void 0;
28597
+
28598
+ (function (CardanoTxOutputSerializationFormat) {
28599
+ CardanoTxOutputSerializationFormat[CardanoTxOutputSerializationFormat["ARRAY_LEGACY"] = 0] = "ARRAY_LEGACY";
28600
+ CardanoTxOutputSerializationFormat[CardanoTxOutputSerializationFormat["MAP_BABBAGE"] = 1] = "MAP_BABBAGE";
28601
+ })(exports.CardanoTxOutputSerializationFormat || (exports.CardanoTxOutputSerializationFormat = {}));
28602
+
28599
28603
  exports.CardanoCertificateType = void 0;
28600
28604
 
28601
28605
  (function (CardanoCertificateType) {
@@ -28617,15 +28621,23 @@ exports.CardanoTxAuxiliaryDataSupplementType = void 0;
28617
28621
 
28618
28622
  (function (CardanoTxAuxiliaryDataSupplementType) {
28619
28623
  CardanoTxAuxiliaryDataSupplementType[CardanoTxAuxiliaryDataSupplementType["NONE"] = 0] = "NONE";
28620
- CardanoTxAuxiliaryDataSupplementType[CardanoTxAuxiliaryDataSupplementType["CATALYST_REGISTRATION_SIGNATURE"] = 1] = "CATALYST_REGISTRATION_SIGNATURE";
28624
+ CardanoTxAuxiliaryDataSupplementType[CardanoTxAuxiliaryDataSupplementType["GOVERNANCE_REGISTRATION_SIGNATURE"] = 1] = "GOVERNANCE_REGISTRATION_SIGNATURE";
28621
28625
  })(exports.CardanoTxAuxiliaryDataSupplementType || (exports.CardanoTxAuxiliaryDataSupplementType = {}));
28622
28626
 
28627
+ exports.CardanoGovernanceRegistrationFormat = void 0;
28628
+
28629
+ (function (CardanoGovernanceRegistrationFormat) {
28630
+ CardanoGovernanceRegistrationFormat[CardanoGovernanceRegistrationFormat["CIP15"] = 0] = "CIP15";
28631
+ CardanoGovernanceRegistrationFormat[CardanoGovernanceRegistrationFormat["CIP36"] = 1] = "CIP36";
28632
+ })(exports.CardanoGovernanceRegistrationFormat || (exports.CardanoGovernanceRegistrationFormat = {}));
28633
+
28623
28634
  exports.CardanoTxSigningMode = void 0;
28624
28635
 
28625
28636
  (function (CardanoTxSigningMode) {
28626
28637
  CardanoTxSigningMode[CardanoTxSigningMode["ORDINARY_TRANSACTION"] = 0] = "ORDINARY_TRANSACTION";
28627
28638
  CardanoTxSigningMode[CardanoTxSigningMode["POOL_REGISTRATION_AS_OWNER"] = 1] = "POOL_REGISTRATION_AS_OWNER";
28628
28639
  CardanoTxSigningMode[CardanoTxSigningMode["MULTISIG_TRANSACTION"] = 2] = "MULTISIG_TRANSACTION";
28640
+ CardanoTxSigningMode[CardanoTxSigningMode["PLUTUS_TRANSACTION"] = 3] = "PLUTUS_TRANSACTION";
28629
28641
  })(exports.CardanoTxSigningMode || (exports.CardanoTxSigningMode = {}));
28630
28642
 
28631
28643
  exports.CardanoTxWitnessType = void 0;
@@ -28924,6 +28936,10 @@ var messages = /*#__PURE__*/Object.freeze({
28924
28936
  return exports.CardanoNativeScriptHashDisplayFormat;
28925
28937
  },
28926
28938
 
28939
+ get CardanoTxOutputSerializationFormat() {
28940
+ return exports.CardanoTxOutputSerializationFormat;
28941
+ },
28942
+
28927
28943
  get CardanoCertificateType() {
28928
28944
  return exports.CardanoCertificateType;
28929
28945
  },
@@ -28936,6 +28952,10 @@ var messages = /*#__PURE__*/Object.freeze({
28936
28952
  return exports.CardanoTxAuxiliaryDataSupplementType;
28937
28953
  },
28938
28954
 
28955
+ get CardanoGovernanceRegistrationFormat() {
28956
+ return exports.CardanoGovernanceRegistrationFormat;
28957
+ },
28958
+
28939
28959
  get CardanoTxSigningMode() {
28940
28960
  return exports.CardanoTxSigningMode;
28941
28961
  },
@@ -43592,7 +43612,7 @@ module.exports = function GetIntrinsic(name, allowMissing) {
43592
43612
 
43593
43613
  var Buffer = (__webpack_require__(7834).Buffer)
43594
43614
  var Transform = (__webpack_require__(4851).Transform)
43595
- var StringDecoder = (__webpack_require__(214)/* .StringDecoder */ .s)
43615
+ var StringDecoder = (__webpack_require__(3974)/* .StringDecoder */ .s)
43596
43616
  var inherits = __webpack_require__(1285)
43597
43617
 
43598
43618
  function CipherBase (hashMode) {
@@ -60884,7 +60904,7 @@ function ReadableState(options, stream, isDuplex) {
60884
60904
  this.encoding = null;
60885
60905
 
60886
60906
  if (options.encoding) {
60887
- if (!StringDecoder) StringDecoder = (__webpack_require__(214)/* .StringDecoder */ .s);
60907
+ if (!StringDecoder) StringDecoder = (__webpack_require__(1922)/* .StringDecoder */ .s);
60888
60908
  this.decoder = new StringDecoder(options.encoding);
60889
60909
  this.encoding = options.encoding;
60890
60910
  }
@@ -61046,7 +61066,7 @@ Readable.prototype.isPaused = function () {
61046
61066
 
61047
61067
 
61048
61068
  Readable.prototype.setEncoding = function (enc) {
61049
- if (!StringDecoder) StringDecoder = (__webpack_require__(214)/* .StringDecoder */ .s);
61069
+ if (!StringDecoder) StringDecoder = (__webpack_require__(1922)/* .StringDecoder */ .s);
61050
61070
  var decoder = new StringDecoder(enc);
61051
61071
  this._readableState.decoder = decoder; // If setEncoding(null), decoder.encoding equals utf8
61052
61072
 
@@ -63569,6 +63589,309 @@ module.exports = {
63569
63589
  module.exports = __webpack_require__(2699).EventEmitter;
63570
63590
 
63571
63591
 
63592
+ /***/ }),
63593
+
63594
+ /***/ 1922:
63595
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
63596
+
63597
+ "use strict";
63598
+ // Copyright Joyent, Inc. and other Node contributors.
63599
+ //
63600
+ // Permission is hereby granted, free of charge, to any person obtaining a
63601
+ // copy of this software and associated documentation files (the
63602
+ // "Software"), to deal in the Software without restriction, including
63603
+ // without limitation the rights to use, copy, modify, merge, publish,
63604
+ // distribute, sublicense, and/or sell copies of the Software, and to permit
63605
+ // persons to whom the Software is furnished to do so, subject to the
63606
+ // following conditions:
63607
+ //
63608
+ // The above copyright notice and this permission notice shall be included
63609
+ // in all copies or substantial portions of the Software.
63610
+ //
63611
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
63612
+ // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
63613
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
63614
+ // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
63615
+ // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
63616
+ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
63617
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
63618
+
63619
+
63620
+
63621
+ /*<replacement>*/
63622
+
63623
+ var Buffer = (__webpack_require__(7834).Buffer);
63624
+ /*</replacement>*/
63625
+
63626
+ var isEncoding = Buffer.isEncoding || function (encoding) {
63627
+ encoding = '' + encoding;
63628
+ switch (encoding && encoding.toLowerCase()) {
63629
+ case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':
63630
+ return true;
63631
+ default:
63632
+ return false;
63633
+ }
63634
+ };
63635
+
63636
+ function _normalizeEncoding(enc) {
63637
+ if (!enc) return 'utf8';
63638
+ var retried;
63639
+ while (true) {
63640
+ switch (enc) {
63641
+ case 'utf8':
63642
+ case 'utf-8':
63643
+ return 'utf8';
63644
+ case 'ucs2':
63645
+ case 'ucs-2':
63646
+ case 'utf16le':
63647
+ case 'utf-16le':
63648
+ return 'utf16le';
63649
+ case 'latin1':
63650
+ case 'binary':
63651
+ return 'latin1';
63652
+ case 'base64':
63653
+ case 'ascii':
63654
+ case 'hex':
63655
+ return enc;
63656
+ default:
63657
+ if (retried) return; // undefined
63658
+ enc = ('' + enc).toLowerCase();
63659
+ retried = true;
63660
+ }
63661
+ }
63662
+ };
63663
+
63664
+ // Do not cache `Buffer.isEncoding` when checking encoding names as some
63665
+ // modules monkey-patch it to support additional encodings
63666
+ function normalizeEncoding(enc) {
63667
+ var nenc = _normalizeEncoding(enc);
63668
+ if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
63669
+ return nenc || enc;
63670
+ }
63671
+
63672
+ // StringDecoder provides an interface for efficiently splitting a series of
63673
+ // buffers into a series of JS strings without breaking apart multi-byte
63674
+ // characters.
63675
+ exports.s = StringDecoder;
63676
+ function StringDecoder(encoding) {
63677
+ this.encoding = normalizeEncoding(encoding);
63678
+ var nb;
63679
+ switch (this.encoding) {
63680
+ case 'utf16le':
63681
+ this.text = utf16Text;
63682
+ this.end = utf16End;
63683
+ nb = 4;
63684
+ break;
63685
+ case 'utf8':
63686
+ this.fillLast = utf8FillLast;
63687
+ nb = 4;
63688
+ break;
63689
+ case 'base64':
63690
+ this.text = base64Text;
63691
+ this.end = base64End;
63692
+ nb = 3;
63693
+ break;
63694
+ default:
63695
+ this.write = simpleWrite;
63696
+ this.end = simpleEnd;
63697
+ return;
63698
+ }
63699
+ this.lastNeed = 0;
63700
+ this.lastTotal = 0;
63701
+ this.lastChar = Buffer.allocUnsafe(nb);
63702
+ }
63703
+
63704
+ StringDecoder.prototype.write = function (buf) {
63705
+ if (buf.length === 0) return '';
63706
+ var r;
63707
+ var i;
63708
+ if (this.lastNeed) {
63709
+ r = this.fillLast(buf);
63710
+ if (r === undefined) return '';
63711
+ i = this.lastNeed;
63712
+ this.lastNeed = 0;
63713
+ } else {
63714
+ i = 0;
63715
+ }
63716
+ if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
63717
+ return r || '';
63718
+ };
63719
+
63720
+ StringDecoder.prototype.end = utf8End;
63721
+
63722
+ // Returns only complete characters in a Buffer
63723
+ StringDecoder.prototype.text = utf8Text;
63724
+
63725
+ // Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
63726
+ StringDecoder.prototype.fillLast = function (buf) {
63727
+ if (this.lastNeed <= buf.length) {
63728
+ buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
63729
+ return this.lastChar.toString(this.encoding, 0, this.lastTotal);
63730
+ }
63731
+ buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
63732
+ this.lastNeed -= buf.length;
63733
+ };
63734
+
63735
+ // Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
63736
+ // continuation byte. If an invalid byte is detected, -2 is returned.
63737
+ function utf8CheckByte(byte) {
63738
+ if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;
63739
+ return byte >> 6 === 0x02 ? -1 : -2;
63740
+ }
63741
+
63742
+ // Checks at most 3 bytes at the end of a Buffer in order to detect an
63743
+ // incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
63744
+ // needed to complete the UTF-8 character (if applicable) are returned.
63745
+ function utf8CheckIncomplete(self, buf, i) {
63746
+ var j = buf.length - 1;
63747
+ if (j < i) return 0;
63748
+ var nb = utf8CheckByte(buf[j]);
63749
+ if (nb >= 0) {
63750
+ if (nb > 0) self.lastNeed = nb - 1;
63751
+ return nb;
63752
+ }
63753
+ if (--j < i || nb === -2) return 0;
63754
+ nb = utf8CheckByte(buf[j]);
63755
+ if (nb >= 0) {
63756
+ if (nb > 0) self.lastNeed = nb - 2;
63757
+ return nb;
63758
+ }
63759
+ if (--j < i || nb === -2) return 0;
63760
+ nb = utf8CheckByte(buf[j]);
63761
+ if (nb >= 0) {
63762
+ if (nb > 0) {
63763
+ if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
63764
+ }
63765
+ return nb;
63766
+ }
63767
+ return 0;
63768
+ }
63769
+
63770
+ // Validates as many continuation bytes for a multi-byte UTF-8 character as
63771
+ // needed or are available. If we see a non-continuation byte where we expect
63772
+ // one, we "replace" the validated continuation bytes we've seen so far with
63773
+ // a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding
63774
+ // behavior. The continuation byte check is included three times in the case
63775
+ // where all of the continuation bytes for a character exist in the same buffer.
63776
+ // It is also done this way as a slight performance increase instead of using a
63777
+ // loop.
63778
+ function utf8CheckExtraBytes(self, buf, p) {
63779
+ if ((buf[0] & 0xC0) !== 0x80) {
63780
+ self.lastNeed = 0;
63781
+ return '\ufffd';
63782
+ }
63783
+ if (self.lastNeed > 1 && buf.length > 1) {
63784
+ if ((buf[1] & 0xC0) !== 0x80) {
63785
+ self.lastNeed = 1;
63786
+ return '\ufffd';
63787
+ }
63788
+ if (self.lastNeed > 2 && buf.length > 2) {
63789
+ if ((buf[2] & 0xC0) !== 0x80) {
63790
+ self.lastNeed = 2;
63791
+ return '\ufffd';
63792
+ }
63793
+ }
63794
+ }
63795
+ }
63796
+
63797
+ // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
63798
+ function utf8FillLast(buf) {
63799
+ var p = this.lastTotal - this.lastNeed;
63800
+ var r = utf8CheckExtraBytes(this, buf, p);
63801
+ if (r !== undefined) return r;
63802
+ if (this.lastNeed <= buf.length) {
63803
+ buf.copy(this.lastChar, p, 0, this.lastNeed);
63804
+ return this.lastChar.toString(this.encoding, 0, this.lastTotal);
63805
+ }
63806
+ buf.copy(this.lastChar, p, 0, buf.length);
63807
+ this.lastNeed -= buf.length;
63808
+ }
63809
+
63810
+ // Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
63811
+ // partial character, the character's bytes are buffered until the required
63812
+ // number of bytes are available.
63813
+ function utf8Text(buf, i) {
63814
+ var total = utf8CheckIncomplete(this, buf, i);
63815
+ if (!this.lastNeed) return buf.toString('utf8', i);
63816
+ this.lastTotal = total;
63817
+ var end = buf.length - (total - this.lastNeed);
63818
+ buf.copy(this.lastChar, 0, end);
63819
+ return buf.toString('utf8', i, end);
63820
+ }
63821
+
63822
+ // For UTF-8, a replacement character is added when ending on a partial
63823
+ // character.
63824
+ function utf8End(buf) {
63825
+ var r = buf && buf.length ? this.write(buf) : '';
63826
+ if (this.lastNeed) return r + '\ufffd';
63827
+ return r;
63828
+ }
63829
+
63830
+ // UTF-16LE typically needs two bytes per character, but even if we have an even
63831
+ // number of bytes available, we need to check if we end on a leading/high
63832
+ // surrogate. In that case, we need to wait for the next two bytes in order to
63833
+ // decode the last character properly.
63834
+ function utf16Text(buf, i) {
63835
+ if ((buf.length - i) % 2 === 0) {
63836
+ var r = buf.toString('utf16le', i);
63837
+ if (r) {
63838
+ var c = r.charCodeAt(r.length - 1);
63839
+ if (c >= 0xD800 && c <= 0xDBFF) {
63840
+ this.lastNeed = 2;
63841
+ this.lastTotal = 4;
63842
+ this.lastChar[0] = buf[buf.length - 2];
63843
+ this.lastChar[1] = buf[buf.length - 1];
63844
+ return r.slice(0, -1);
63845
+ }
63846
+ }
63847
+ return r;
63848
+ }
63849
+ this.lastNeed = 1;
63850
+ this.lastTotal = 2;
63851
+ this.lastChar[0] = buf[buf.length - 1];
63852
+ return buf.toString('utf16le', i, buf.length - 1);
63853
+ }
63854
+
63855
+ // For UTF-16LE we do not explicitly append special replacement characters if we
63856
+ // end on a partial character, we simply let v8 handle that.
63857
+ function utf16End(buf) {
63858
+ var r = buf && buf.length ? this.write(buf) : '';
63859
+ if (this.lastNeed) {
63860
+ var end = this.lastTotal - this.lastNeed;
63861
+ return r + this.lastChar.toString('utf16le', 0, end);
63862
+ }
63863
+ return r;
63864
+ }
63865
+
63866
+ function base64Text(buf, i) {
63867
+ var n = (buf.length - i) % 3;
63868
+ if (n === 0) return buf.toString('base64', i);
63869
+ this.lastNeed = 3 - n;
63870
+ this.lastTotal = 3;
63871
+ if (n === 1) {
63872
+ this.lastChar[0] = buf[buf.length - 1];
63873
+ } else {
63874
+ this.lastChar[0] = buf[buf.length - 2];
63875
+ this.lastChar[1] = buf[buf.length - 1];
63876
+ }
63877
+ return buf.toString('base64', i, buf.length - n);
63878
+ }
63879
+
63880
+ function base64End(buf) {
63881
+ var r = buf && buf.length ? this.write(buf) : '';
63882
+ if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
63883
+ return r;
63884
+ }
63885
+
63886
+ // Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
63887
+ function simpleWrite(buf) {
63888
+ return buf.toString(this.encoding);
63889
+ }
63890
+
63891
+ function simpleEnd(buf) {
63892
+ return buf && buf.length ? this.write(buf) : '';
63893
+ }
63894
+
63572
63895
  /***/ }),
63573
63896
 
63574
63897
  /***/ 696:
@@ -71353,10 +71676,9 @@ Stream.prototype.pipe = function(dest, options) {
71353
71676
 
71354
71677
  /***/ }),
71355
71678
 
71356
- /***/ 214:
71679
+ /***/ 3974:
71357
71680
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
71358
71681
 
71359
- "use strict";
71360
71682
  // Copyright Joyent, Inc. and other Node contributors.
71361
71683
  //
71362
71684
  // Permission is hereby granted, free of charge, to any person obtaining a
@@ -71378,282 +71700,208 @@ Stream.prototype.pipe = function(dest, options) {
71378
71700
  // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
71379
71701
  // USE OR OTHER DEALINGS IN THE SOFTWARE.
71380
71702
 
71703
+ var Buffer = (__webpack_require__(8834).Buffer);
71381
71704
 
71705
+ var isBufferEncoding = Buffer.isEncoding
71706
+ || function(encoding) {
71707
+ switch (encoding && encoding.toLowerCase()) {
71708
+ case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true;
71709
+ default: return false;
71710
+ }
71711
+ }
71382
71712
 
71383
- /*<replacement>*/
71384
71713
 
71385
- var Buffer = (__webpack_require__(7834).Buffer);
71386
- /*</replacement>*/
71387
-
71388
- var isEncoding = Buffer.isEncoding || function (encoding) {
71389
- encoding = '' + encoding;
71390
- switch (encoding && encoding.toLowerCase()) {
71391
- case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':
71392
- return true;
71393
- default:
71394
- return false;
71714
+ function assertEncoding(encoding) {
71715
+ if (encoding && !isBufferEncoding(encoding)) {
71716
+ throw new Error('Unknown encoding: ' + encoding);
71395
71717
  }
71396
- };
71397
-
71398
- function _normalizeEncoding(enc) {
71399
- if (!enc) return 'utf8';
71400
- var retried;
71401
- while (true) {
71402
- switch (enc) {
71403
- case 'utf8':
71404
- case 'utf-8':
71405
- return 'utf8';
71406
- case 'ucs2':
71407
- case 'ucs-2':
71408
- case 'utf16le':
71409
- case 'utf-16le':
71410
- return 'utf16le';
71411
- case 'latin1':
71412
- case 'binary':
71413
- return 'latin1';
71414
- case 'base64':
71415
- case 'ascii':
71416
- case 'hex':
71417
- return enc;
71418
- default:
71419
- if (retried) return; // undefined
71420
- enc = ('' + enc).toLowerCase();
71421
- retried = true;
71422
- }
71423
- }
71424
- };
71425
-
71426
- // Do not cache `Buffer.isEncoding` when checking encoding names as some
71427
- // modules monkey-patch it to support additional encodings
71428
- function normalizeEncoding(enc) {
71429
- var nenc = _normalizeEncoding(enc);
71430
- if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
71431
- return nenc || enc;
71432
71718
  }
71433
71719
 
71434
71720
  // StringDecoder provides an interface for efficiently splitting a series of
71435
71721
  // buffers into a series of JS strings without breaking apart multi-byte
71436
- // characters.
71437
- exports.s = StringDecoder;
71438
- function StringDecoder(encoding) {
71439
- this.encoding = normalizeEncoding(encoding);
71440
- var nb;
71722
+ // characters. CESU-8 is handled as part of the UTF-8 encoding.
71723
+ //
71724
+ // @TODO Handling all encodings inside a single object makes it very difficult
71725
+ // to reason about this code, so it should be split up in the future.
71726
+ // @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code
71727
+ // points as used by CESU-8.
71728
+ var StringDecoder = exports.s = function(encoding) {
71729
+ this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, '');
71730
+ assertEncoding(encoding);
71441
71731
  switch (this.encoding) {
71442
- case 'utf16le':
71443
- this.text = utf16Text;
71444
- this.end = utf16End;
71445
- nb = 4;
71446
- break;
71447
71732
  case 'utf8':
71448
- this.fillLast = utf8FillLast;
71449
- nb = 4;
71733
+ // CESU-8 represents each of Surrogate Pair by 3-bytes
71734
+ this.surrogateSize = 3;
71735
+ break;
71736
+ case 'ucs2':
71737
+ case 'utf16le':
71738
+ // UTF-16 represents each of Surrogate Pair by 2-bytes
71739
+ this.surrogateSize = 2;
71740
+ this.detectIncompleteChar = utf16DetectIncompleteChar;
71450
71741
  break;
71451
71742
  case 'base64':
71452
- this.text = base64Text;
71453
- this.end = base64End;
71454
- nb = 3;
71743
+ // Base-64 stores 3 bytes in 4 chars, and pads the remainder.
71744
+ this.surrogateSize = 3;
71745
+ this.detectIncompleteChar = base64DetectIncompleteChar;
71455
71746
  break;
71456
71747
  default:
71457
- this.write = simpleWrite;
71458
- this.end = simpleEnd;
71748
+ this.write = passThroughWrite;
71459
71749
  return;
71460
71750
  }
71461
- this.lastNeed = 0;
71462
- this.lastTotal = 0;
71463
- this.lastChar = Buffer.allocUnsafe(nb);
71464
- }
71465
71751
 
71466
- StringDecoder.prototype.write = function (buf) {
71467
- if (buf.length === 0) return '';
71468
- var r;
71469
- var i;
71470
- if (this.lastNeed) {
71471
- r = this.fillLast(buf);
71472
- if (r === undefined) return '';
71473
- i = this.lastNeed;
71474
- this.lastNeed = 0;
71475
- } else {
71476
- i = 0;
71477
- }
71478
- if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
71479
- return r || '';
71752
+ // Enough space to store all bytes of a single character. UTF-8 needs 4
71753
+ // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate).
71754
+ this.charBuffer = new Buffer(6);
71755
+ // Number of bytes received for the current incomplete multi-byte character.
71756
+ this.charReceived = 0;
71757
+ // Number of bytes expected for the current incomplete multi-byte character.
71758
+ this.charLength = 0;
71480
71759
  };
71481
71760
 
71482
- StringDecoder.prototype.end = utf8End;
71483
71761
 
71484
- // Returns only complete characters in a Buffer
71485
- StringDecoder.prototype.text = utf8Text;
71762
+ // write decodes the given buffer and returns it as JS string that is
71763
+ // guaranteed to not contain any partial multi-byte characters. Any partial
71764
+ // character found at the end of the buffer is buffered up, and will be
71765
+ // returned when calling write again with the remaining bytes.
71766
+ //
71767
+ // Note: Converting a Buffer containing an orphan surrogate to a String
71768
+ // currently works, but converting a String to a Buffer (via `new Buffer`, or
71769
+ // Buffer#write) will replace incomplete surrogates with the unicode
71770
+ // replacement character. See https://codereview.chromium.org/121173009/ .
71771
+ StringDecoder.prototype.write = function(buffer) {
71772
+ var charStr = '';
71773
+ // if our last write ended with an incomplete multibyte character
71774
+ while (this.charLength) {
71775
+ // determine how many remaining bytes this buffer has to offer for this char
71776
+ var available = (buffer.length >= this.charLength - this.charReceived) ?
71777
+ this.charLength - this.charReceived :
71778
+ buffer.length;
71779
+
71780
+ // add the new bytes to the char buffer
71781
+ buffer.copy(this.charBuffer, this.charReceived, 0, available);
71782
+ this.charReceived += available;
71783
+
71784
+ if (this.charReceived < this.charLength) {
71785
+ // still not enough chars in this buffer? wait for more ...
71786
+ return '';
71787
+ }
71788
+
71789
+ // remove bytes belonging to the current character from the buffer
71790
+ buffer = buffer.slice(available, buffer.length);
71791
+
71792
+ // get the character that was split
71793
+ charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding);
71794
+
71795
+ // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
71796
+ var charCode = charStr.charCodeAt(charStr.length - 1);
71797
+ if (charCode >= 0xD800 && charCode <= 0xDBFF) {
71798
+ this.charLength += this.surrogateSize;
71799
+ charStr = '';
71800
+ continue;
71801
+ }
71802
+ this.charReceived = this.charLength = 0;
71486
71803
 
71487
- // Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
71488
- StringDecoder.prototype.fillLast = function (buf) {
71489
- if (this.lastNeed <= buf.length) {
71490
- buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
71491
- return this.lastChar.toString(this.encoding, 0, this.lastTotal);
71804
+ // if there are no more bytes in this buffer, just emit our char
71805
+ if (buffer.length === 0) {
71806
+ return charStr;
71807
+ }
71808
+ break;
71492
71809
  }
71493
- buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
71494
- this.lastNeed -= buf.length;
71495
- };
71496
71810
 
71497
- // Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
71498
- // continuation byte. If an invalid byte is detected, -2 is returned.
71499
- function utf8CheckByte(byte) {
71500
- if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;
71501
- return byte >> 6 === 0x02 ? -1 : -2;
71502
- }
71811
+ // determine and set charLength / charReceived
71812
+ this.detectIncompleteChar(buffer);
71503
71813
 
71504
- // Checks at most 3 bytes at the end of a Buffer in order to detect an
71505
- // incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
71506
- // needed to complete the UTF-8 character (if applicable) are returned.
71507
- function utf8CheckIncomplete(self, buf, i) {
71508
- var j = buf.length - 1;
71509
- if (j < i) return 0;
71510
- var nb = utf8CheckByte(buf[j]);
71511
- if (nb >= 0) {
71512
- if (nb > 0) self.lastNeed = nb - 1;
71513
- return nb;
71514
- }
71515
- if (--j < i || nb === -2) return 0;
71516
- nb = utf8CheckByte(buf[j]);
71517
- if (nb >= 0) {
71518
- if (nb > 0) self.lastNeed = nb - 2;
71519
- return nb;
71814
+ var end = buffer.length;
71815
+ if (this.charLength) {
71816
+ // buffer the incomplete character bytes we got
71817
+ buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end);
71818
+ end -= this.charReceived;
71520
71819
  }
71521
- if (--j < i || nb === -2) return 0;
71522
- nb = utf8CheckByte(buf[j]);
71523
- if (nb >= 0) {
71524
- if (nb > 0) {
71525
- if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
71526
- }
71527
- return nb;
71528
- }
71529
- return 0;
71530
- }
71531
71820
 
71532
- // Validates as many continuation bytes for a multi-byte UTF-8 character as
71533
- // needed or are available. If we see a non-continuation byte where we expect
71534
- // one, we "replace" the validated continuation bytes we've seen so far with
71535
- // a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding
71536
- // behavior. The continuation byte check is included three times in the case
71537
- // where all of the continuation bytes for a character exist in the same buffer.
71538
- // It is also done this way as a slight performance increase instead of using a
71539
- // loop.
71540
- function utf8CheckExtraBytes(self, buf, p) {
71541
- if ((buf[0] & 0xC0) !== 0x80) {
71542
- self.lastNeed = 0;
71543
- return '\ufffd';
71544
- }
71545
- if (self.lastNeed > 1 && buf.length > 1) {
71546
- if ((buf[1] & 0xC0) !== 0x80) {
71547
- self.lastNeed = 1;
71548
- return '\ufffd';
71549
- }
71550
- if (self.lastNeed > 2 && buf.length > 2) {
71551
- if ((buf[2] & 0xC0) !== 0x80) {
71552
- self.lastNeed = 2;
71553
- return '\ufffd';
71554
- }
71555
- }
71556
- }
71557
- }
71821
+ charStr += buffer.toString(this.encoding, 0, end);
71558
71822
 
71559
- // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
71560
- function utf8FillLast(buf) {
71561
- var p = this.lastTotal - this.lastNeed;
71562
- var r = utf8CheckExtraBytes(this, buf, p);
71563
- if (r !== undefined) return r;
71564
- if (this.lastNeed <= buf.length) {
71565
- buf.copy(this.lastChar, p, 0, this.lastNeed);
71566
- return this.lastChar.toString(this.encoding, 0, this.lastTotal);
71823
+ var end = charStr.length - 1;
71824
+ var charCode = charStr.charCodeAt(end);
71825
+ // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
71826
+ if (charCode >= 0xD800 && charCode <= 0xDBFF) {
71827
+ var size = this.surrogateSize;
71828
+ this.charLength += size;
71829
+ this.charReceived += size;
71830
+ this.charBuffer.copy(this.charBuffer, size, 0, size);
71831
+ buffer.copy(this.charBuffer, 0, 0, size);
71832
+ return charStr.substring(0, end);
71567
71833
  }
71568
- buf.copy(this.lastChar, p, 0, buf.length);
71569
- this.lastNeed -= buf.length;
71570
- }
71571
71834
 
71572
- // Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
71573
- // partial character, the character's bytes are buffered until the required
71574
- // number of bytes are available.
71575
- function utf8Text(buf, i) {
71576
- var total = utf8CheckIncomplete(this, buf, i);
71577
- if (!this.lastNeed) return buf.toString('utf8', i);
71578
- this.lastTotal = total;
71579
- var end = buf.length - (total - this.lastNeed);
71580
- buf.copy(this.lastChar, 0, end);
71581
- return buf.toString('utf8', i, end);
71582
- }
71835
+ // or just emit the charStr
71836
+ return charStr;
71837
+ };
71583
71838
 
71584
- // For UTF-8, a replacement character is added when ending on a partial
71585
- // character.
71586
- function utf8End(buf) {
71587
- var r = buf && buf.length ? this.write(buf) : '';
71588
- if (this.lastNeed) return r + '\ufffd';
71589
- return r;
71590
- }
71839
+ // detectIncompleteChar determines if there is an incomplete UTF-8 character at
71840
+ // the end of the given buffer. If so, it sets this.charLength to the byte
71841
+ // length that character, and sets this.charReceived to the number of bytes
71842
+ // that are available for this character.
71843
+ StringDecoder.prototype.detectIncompleteChar = function(buffer) {
71844
+ // determine how many bytes we have to check at the end of this buffer
71845
+ var i = (buffer.length >= 3) ? 3 : buffer.length;
71591
71846
 
71592
- // UTF-16LE typically needs two bytes per character, but even if we have an even
71593
- // number of bytes available, we need to check if we end on a leading/high
71594
- // surrogate. In that case, we need to wait for the next two bytes in order to
71595
- // decode the last character properly.
71596
- function utf16Text(buf, i) {
71597
- if ((buf.length - i) % 2 === 0) {
71598
- var r = buf.toString('utf16le', i);
71599
- if (r) {
71600
- var c = r.charCodeAt(r.length - 1);
71601
- if (c >= 0xD800 && c <= 0xDBFF) {
71602
- this.lastNeed = 2;
71603
- this.lastTotal = 4;
71604
- this.lastChar[0] = buf[buf.length - 2];
71605
- this.lastChar[1] = buf[buf.length - 1];
71606
- return r.slice(0, -1);
71607
- }
71847
+ // Figure out if one of the last i bytes of our buffer announces an
71848
+ // incomplete char.
71849
+ for (; i > 0; i--) {
71850
+ var c = buffer[buffer.length - i];
71851
+
71852
+ // See http://en.wikipedia.org/wiki/UTF-8#Description
71853
+
71854
+ // 110XXXXX
71855
+ if (i == 1 && c >> 5 == 0x06) {
71856
+ this.charLength = 2;
71857
+ break;
71608
71858
  }
71609
- return r;
71610
- }
71611
- this.lastNeed = 1;
71612
- this.lastTotal = 2;
71613
- this.lastChar[0] = buf[buf.length - 1];
71614
- return buf.toString('utf16le', i, buf.length - 1);
71615
- }
71616
71859
 
71617
- // For UTF-16LE we do not explicitly append special replacement characters if we
71618
- // end on a partial character, we simply let v8 handle that.
71619
- function utf16End(buf) {
71620
- var r = buf && buf.length ? this.write(buf) : '';
71621
- if (this.lastNeed) {
71622
- var end = this.lastTotal - this.lastNeed;
71623
- return r + this.lastChar.toString('utf16le', 0, end);
71860
+ // 1110XXXX
71861
+ if (i <= 2 && c >> 4 == 0x0E) {
71862
+ this.charLength = 3;
71863
+ break;
71864
+ }
71865
+
71866
+ // 11110XXX
71867
+ if (i <= 3 && c >> 3 == 0x1E) {
71868
+ this.charLength = 4;
71869
+ break;
71870
+ }
71624
71871
  }
71625
- return r;
71626
- }
71872
+ this.charReceived = i;
71873
+ };
71627
71874
 
71628
- function base64Text(buf, i) {
71629
- var n = (buf.length - i) % 3;
71630
- if (n === 0) return buf.toString('base64', i);
71631
- this.lastNeed = 3 - n;
71632
- this.lastTotal = 3;
71633
- if (n === 1) {
71634
- this.lastChar[0] = buf[buf.length - 1];
71635
- } else {
71636
- this.lastChar[0] = buf[buf.length - 2];
71637
- this.lastChar[1] = buf[buf.length - 1];
71875
+ StringDecoder.prototype.end = function(buffer) {
71876
+ var res = '';
71877
+ if (buffer && buffer.length)
71878
+ res = this.write(buffer);
71879
+
71880
+ if (this.charReceived) {
71881
+ var cr = this.charReceived;
71882
+ var buf = this.charBuffer;
71883
+ var enc = this.encoding;
71884
+ res += buf.slice(0, cr).toString(enc);
71638
71885
  }
71639
- return buf.toString('base64', i, buf.length - n);
71640
- }
71641
71886
 
71642
- function base64End(buf) {
71643
- var r = buf && buf.length ? this.write(buf) : '';
71644
- if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
71645
- return r;
71887
+ return res;
71888
+ };
71889
+
71890
+ function passThroughWrite(buffer) {
71891
+ return buffer.toString(this.encoding);
71646
71892
  }
71647
71893
 
71648
- // Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
71649
- function simpleWrite(buf) {
71650
- return buf.toString(this.encoding);
71894
+ function utf16DetectIncompleteChar(buffer) {
71895
+ this.charReceived = buffer.length % 2;
71896
+ this.charLength = this.charReceived ? 2 : 0;
71651
71897
  }
71652
71898
 
71653
- function simpleEnd(buf) {
71654
- return buf && buf.length ? this.write(buf) : '';
71899
+ function base64DetectIncompleteChar(buffer) {
71900
+ this.charReceived = buffer.length % 3;
71901
+ this.charLength = this.charReceived ? 3 : 0;
71655
71902
  }
71656
71903
 
71904
+
71657
71905
  /***/ }),
71658
71906
 
71659
71907
  /***/ 5803:
@@ -73424,7 +73672,7 @@ module.exports = {"i8":"6.5.4"};
73424
73672
  /***/ ((module) => {
73425
73673
 
73426
73674
  "use strict";
73427
- module.exports = JSON.parse('{"name":"@onekeyfe/hd-core","version":"0.2.10","description":"> TODO: description","author":"OneKey","homepage":"https://github.com/OneKeyHQ/hardware-js-sdk#readme","license":"ISC","main":"dist/index.js","types":"dist/index.d.ts","repository":{"type":"git","url":"git+https://github.com/OneKeyHQ/hardware-js-sdk.git"},"publishConfig":{"access":"public"},"scripts":{"dev":"rimraf dist && rollup -c ../../build/rollup.config.js -w","build":"rimraf dist && rollup -c ../../build/rollup.config.js","lint":"eslint .","lint:fix":"eslint . --fix"},"bugs":{"url":"https://github.com/OneKeyHQ/hardware-js-sdk/issues"},"dependencies":{"@onekeyfe/hd-shared":"^0.2.10","@onekeyfe/hd-transport":"^0.2.10","axios":"^0.27.2","bignumber.js":"^9.0.2","jszip":"^3.10.1","parse-uri":"^1.0.7","semver":"^7.3.7"},"peerDependencies":{"@noble/hashes":"^1.1.3","ripple-keypairs":"^1.1.4"},"devDependencies":{"@noble/hashes":"^1.1.3","@types/parse-uri":"^1.0.0","@types/semver":"^7.3.9","ripple-keypairs":"^1.1.4"}}');
73675
+ module.exports = JSON.parse('{"name":"@onekeyfe/hd-core","version":"0.2.12","description":"> TODO: description","author":"OneKey","homepage":"https://github.com/OneKeyHQ/hardware-js-sdk#readme","license":"ISC","main":"dist/index.js","types":"dist/index.d.ts","repository":{"type":"git","url":"git+https://github.com/OneKeyHQ/hardware-js-sdk.git"},"publishConfig":{"access":"public"},"scripts":{"dev":"rimraf dist && rollup -c ../../build/rollup.config.js -w","build":"rimraf dist && rollup -c ../../build/rollup.config.js","lint":"eslint .","lint:fix":"eslint . --fix"},"bugs":{"url":"https://github.com/OneKeyHQ/hardware-js-sdk/issues"},"dependencies":{"@onekeyfe/hd-shared":"^0.2.12","@onekeyfe/hd-transport":"^0.2.12","axios":"^0.27.2","bignumber.js":"^9.0.2","jszip":"^3.10.1","parse-uri":"^1.0.7","semver":"^7.3.7"},"peerDependencies":{"@noble/hashes":"^1.1.3","ripple-keypairs":"^1.1.4"},"devDependencies":{"@noble/hashes":"^1.1.3","@types/parse-uri":"^1.0.0","@types/semver":"^7.3.9","ripple-keypairs":"^1.1.4"}}');
73428
73676
 
73429
73677
  /***/ })
73430
73678
 
@@ -75963,7 +76211,7 @@ const src_init = async settings => {
75963
76211
 
75964
76212
  try {
75965
76213
  await init({ ..._settings,
75966
- version: "0.2.10"
76214
+ version: "0.2.12"
75967
76215
  });
75968
76216
  return true;
75969
76217
  } catch (e) {