@keystonehq/react-native-keystone-wallet-core 0.1.0-alpha.0 → 0.1.0-alpha.3
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/android/src/main/java/com/reactnativekeystonewalletcore/KeystoneWalletCoreModule.kt +135 -0
- package/ios/Frameworks/KeystoneWalletCoreFFI.xcframework/Info.plist +4 -4
- package/ios/Frameworks/KeystoneWalletCoreFFI.xcframework/ios-arm64/KeystoneWalletCoreFFI.framework/Headers/keystone_wallet_coreFFI.h +79 -12
- package/ios/Frameworks/KeystoneWalletCoreFFI.xcframework/ios-arm64/KeystoneWalletCoreFFI.framework/KeystoneWalletCoreFFI +0 -0
- package/ios/Frameworks/KeystoneWalletCoreFFI.xcframework/ios-arm64-simulator/KeystoneWalletCoreFFI.framework/Headers/keystone_wallet_coreFFI.h +79 -12
- package/ios/Frameworks/KeystoneWalletCoreFFI.xcframework/ios-arm64-simulator/KeystoneWalletCoreFFI.framework/KeystoneWalletCoreFFI +0 -0
- package/ios/KeystoneWalletCoreModule.m +37 -1
- package/ios/KeystoneWalletCoreModule.swift +120 -3
- package/ios/keystone_wallet_core.swift +575 -10
- package/lib/commonjs/index.js +33 -3
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +25 -2
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/index.d.ts +29 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.tsx +84 -2
|
@@ -442,6 +442,30 @@ fileprivate struct FfiConverterUInt64: FfiConverterPrimitive {
|
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
444
|
|
|
445
|
+
#if swift(>=5.8)
|
|
446
|
+
@_documentation(visibility: private)
|
|
447
|
+
#endif
|
|
448
|
+
fileprivate struct FfiConverterBool : FfiConverter {
|
|
449
|
+
typealias FfiType = Int8
|
|
450
|
+
typealias SwiftType = Bool
|
|
451
|
+
|
|
452
|
+
public static func lift(_ value: Int8) throws -> Bool {
|
|
453
|
+
return value != 0
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
public static func lower(_ value: Bool) -> Int8 {
|
|
457
|
+
return value ? 1 : 0
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Bool {
|
|
461
|
+
return try lift(readInt(&buf))
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
public static func write(_ value: Bool, into buf: inout [UInt8]) {
|
|
465
|
+
writeInt(&buf, lower(value))
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
445
469
|
#if swift(>=5.8)
|
|
446
470
|
@_documentation(visibility: private)
|
|
447
471
|
#endif
|
|
@@ -604,6 +628,286 @@ public func FfiConverterTypePczt_lower(_ value: Pczt) -> UnsafeMutableRawPointer
|
|
|
604
628
|
}
|
|
605
629
|
|
|
606
630
|
|
|
631
|
+
public struct CardanoTxInput {
|
|
632
|
+
public var txHash: String
|
|
633
|
+
public var txIndex: UInt32
|
|
634
|
+
public var amount: UInt64
|
|
635
|
+
|
|
636
|
+
// Default memberwise initializers are never public by default, so we
|
|
637
|
+
// declare one manually.
|
|
638
|
+
public init(txHash: String, txIndex: UInt32, amount: UInt64) {
|
|
639
|
+
self.txHash = txHash
|
|
640
|
+
self.txIndex = txIndex
|
|
641
|
+
self.amount = amount
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
|
|
646
|
+
|
|
647
|
+
extension CardanoTxInput: Equatable, Hashable {
|
|
648
|
+
public static func ==(lhs: CardanoTxInput, rhs: CardanoTxInput) -> Bool {
|
|
649
|
+
if lhs.txHash != rhs.txHash {
|
|
650
|
+
return false
|
|
651
|
+
}
|
|
652
|
+
if lhs.txIndex != rhs.txIndex {
|
|
653
|
+
return false
|
|
654
|
+
}
|
|
655
|
+
if lhs.amount != rhs.amount {
|
|
656
|
+
return false
|
|
657
|
+
}
|
|
658
|
+
return true
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
public func hash(into hasher: inout Hasher) {
|
|
662
|
+
hasher.combine(txHash)
|
|
663
|
+
hasher.combine(txIndex)
|
|
664
|
+
hasher.combine(amount)
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
#if swift(>=5.8)
|
|
670
|
+
@_documentation(visibility: private)
|
|
671
|
+
#endif
|
|
672
|
+
public struct FfiConverterTypeCardanoTxInput: FfiConverterRustBuffer {
|
|
673
|
+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> CardanoTxInput {
|
|
674
|
+
return
|
|
675
|
+
try CardanoTxInput(
|
|
676
|
+
txHash: FfiConverterString.read(from: &buf),
|
|
677
|
+
txIndex: FfiConverterUInt32.read(from: &buf),
|
|
678
|
+
amount: FfiConverterUInt64.read(from: &buf)
|
|
679
|
+
)
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
public static func write(_ value: CardanoTxInput, into buf: inout [UInt8]) {
|
|
683
|
+
FfiConverterString.write(value.txHash, into: &buf)
|
|
684
|
+
FfiConverterUInt32.write(value.txIndex, into: &buf)
|
|
685
|
+
FfiConverterUInt64.write(value.amount, into: &buf)
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
|
|
690
|
+
#if swift(>=5.8)
|
|
691
|
+
@_documentation(visibility: private)
|
|
692
|
+
#endif
|
|
693
|
+
public func FfiConverterTypeCardanoTxInput_lift(_ buf: RustBuffer) throws -> CardanoTxInput {
|
|
694
|
+
return try FfiConverterTypeCardanoTxInput.lift(buf)
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
#if swift(>=5.8)
|
|
698
|
+
@_documentation(visibility: private)
|
|
699
|
+
#endif
|
|
700
|
+
public func FfiConverterTypeCardanoTxInput_lower(_ value: CardanoTxInput) -> RustBuffer {
|
|
701
|
+
return FfiConverterTypeCardanoTxInput.lower(value)
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
public struct CardanoTxOutput {
|
|
706
|
+
public var address: String
|
|
707
|
+
public var amount: UInt64
|
|
708
|
+
public var isChange: Bool
|
|
709
|
+
|
|
710
|
+
// Default memberwise initializers are never public by default, so we
|
|
711
|
+
// declare one manually.
|
|
712
|
+
public init(address: String, amount: UInt64, isChange: Bool) {
|
|
713
|
+
self.address = address
|
|
714
|
+
self.amount = amount
|
|
715
|
+
self.isChange = isChange
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
|
|
720
|
+
|
|
721
|
+
extension CardanoTxOutput: Equatable, Hashable {
|
|
722
|
+
public static func ==(lhs: CardanoTxOutput, rhs: CardanoTxOutput) -> Bool {
|
|
723
|
+
if lhs.address != rhs.address {
|
|
724
|
+
return false
|
|
725
|
+
}
|
|
726
|
+
if lhs.amount != rhs.amount {
|
|
727
|
+
return false
|
|
728
|
+
}
|
|
729
|
+
if lhs.isChange != rhs.isChange {
|
|
730
|
+
return false
|
|
731
|
+
}
|
|
732
|
+
return true
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
public func hash(into hasher: inout Hasher) {
|
|
736
|
+
hasher.combine(address)
|
|
737
|
+
hasher.combine(amount)
|
|
738
|
+
hasher.combine(isChange)
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
|
|
743
|
+
#if swift(>=5.8)
|
|
744
|
+
@_documentation(visibility: private)
|
|
745
|
+
#endif
|
|
746
|
+
public struct FfiConverterTypeCardanoTxOutput: FfiConverterRustBuffer {
|
|
747
|
+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> CardanoTxOutput {
|
|
748
|
+
return
|
|
749
|
+
try CardanoTxOutput(
|
|
750
|
+
address: FfiConverterString.read(from: &buf),
|
|
751
|
+
amount: FfiConverterUInt64.read(from: &buf),
|
|
752
|
+
isChange: FfiConverterBool.read(from: &buf)
|
|
753
|
+
)
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
public static func write(_ value: CardanoTxOutput, into buf: inout [UInt8]) {
|
|
757
|
+
FfiConverterString.write(value.address, into: &buf)
|
|
758
|
+
FfiConverterUInt64.write(value.amount, into: &buf)
|
|
759
|
+
FfiConverterBool.write(value.isChange, into: &buf)
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
|
|
764
|
+
#if swift(>=5.8)
|
|
765
|
+
@_documentation(visibility: private)
|
|
766
|
+
#endif
|
|
767
|
+
public func FfiConverterTypeCardanoTxOutput_lift(_ buf: RustBuffer) throws -> CardanoTxOutput {
|
|
768
|
+
return try FfiConverterTypeCardanoTxOutput.lift(buf)
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
#if swift(>=5.8)
|
|
772
|
+
@_documentation(visibility: private)
|
|
773
|
+
#endif
|
|
774
|
+
public func FfiConverterTypeCardanoTxOutput_lower(_ value: CardanoTxOutput) -> RustBuffer {
|
|
775
|
+
return FfiConverterTypeCardanoTxOutput.lower(value)
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
|
|
779
|
+
public struct DerivedKeys {
|
|
780
|
+
public var paymentPubkeyHex: String
|
|
781
|
+
public var stakePubkeyHex: String
|
|
782
|
+
|
|
783
|
+
// Default memberwise initializers are never public by default, so we
|
|
784
|
+
// declare one manually.
|
|
785
|
+
public init(paymentPubkeyHex: String, stakePubkeyHex: String) {
|
|
786
|
+
self.paymentPubkeyHex = paymentPubkeyHex
|
|
787
|
+
self.stakePubkeyHex = stakePubkeyHex
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
|
|
792
|
+
|
|
793
|
+
extension DerivedKeys: Equatable, Hashable {
|
|
794
|
+
public static func ==(lhs: DerivedKeys, rhs: DerivedKeys) -> Bool {
|
|
795
|
+
if lhs.paymentPubkeyHex != rhs.paymentPubkeyHex {
|
|
796
|
+
return false
|
|
797
|
+
}
|
|
798
|
+
if lhs.stakePubkeyHex != rhs.stakePubkeyHex {
|
|
799
|
+
return false
|
|
800
|
+
}
|
|
801
|
+
return true
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
public func hash(into hasher: inout Hasher) {
|
|
805
|
+
hasher.combine(paymentPubkeyHex)
|
|
806
|
+
hasher.combine(stakePubkeyHex)
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
#if swift(>=5.8)
|
|
812
|
+
@_documentation(visibility: private)
|
|
813
|
+
#endif
|
|
814
|
+
public struct FfiConverterTypeDerivedKeys: FfiConverterRustBuffer {
|
|
815
|
+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> DerivedKeys {
|
|
816
|
+
return
|
|
817
|
+
try DerivedKeys(
|
|
818
|
+
paymentPubkeyHex: FfiConverterString.read(from: &buf),
|
|
819
|
+
stakePubkeyHex: FfiConverterString.read(from: &buf)
|
|
820
|
+
)
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
public static func write(_ value: DerivedKeys, into buf: inout [UInt8]) {
|
|
824
|
+
FfiConverterString.write(value.paymentPubkeyHex, into: &buf)
|
|
825
|
+
FfiConverterString.write(value.stakePubkeyHex, into: &buf)
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
|
|
830
|
+
#if swift(>=5.8)
|
|
831
|
+
@_documentation(visibility: private)
|
|
832
|
+
#endif
|
|
833
|
+
public func FfiConverterTypeDerivedKeys_lift(_ buf: RustBuffer) throws -> DerivedKeys {
|
|
834
|
+
return try FfiConverterTypeDerivedKeys.lift(buf)
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
#if swift(>=5.8)
|
|
838
|
+
@_documentation(visibility: private)
|
|
839
|
+
#endif
|
|
840
|
+
public func FfiConverterTypeDerivedKeys_lower(_ value: DerivedKeys) -> RustBuffer {
|
|
841
|
+
return FfiConverterTypeDerivedKeys.lower(value)
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
|
|
845
|
+
public struct SignedTxResult {
|
|
846
|
+
public var txId: String
|
|
847
|
+
public var txHex: String
|
|
848
|
+
|
|
849
|
+
// Default memberwise initializers are never public by default, so we
|
|
850
|
+
// declare one manually.
|
|
851
|
+
public init(txId: String, txHex: String) {
|
|
852
|
+
self.txId = txId
|
|
853
|
+
self.txHex = txHex
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
|
|
858
|
+
|
|
859
|
+
extension SignedTxResult: Equatable, Hashable {
|
|
860
|
+
public static func ==(lhs: SignedTxResult, rhs: SignedTxResult) -> Bool {
|
|
861
|
+
if lhs.txId != rhs.txId {
|
|
862
|
+
return false
|
|
863
|
+
}
|
|
864
|
+
if lhs.txHex != rhs.txHex {
|
|
865
|
+
return false
|
|
866
|
+
}
|
|
867
|
+
return true
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
public func hash(into hasher: inout Hasher) {
|
|
871
|
+
hasher.combine(txId)
|
|
872
|
+
hasher.combine(txHex)
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
|
|
877
|
+
#if swift(>=5.8)
|
|
878
|
+
@_documentation(visibility: private)
|
|
879
|
+
#endif
|
|
880
|
+
public struct FfiConverterTypeSignedTxResult: FfiConverterRustBuffer {
|
|
881
|
+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SignedTxResult {
|
|
882
|
+
return
|
|
883
|
+
try SignedTxResult(
|
|
884
|
+
txId: FfiConverterString.read(from: &buf),
|
|
885
|
+
txHex: FfiConverterString.read(from: &buf)
|
|
886
|
+
)
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
public static func write(_ value: SignedTxResult, into buf: inout [UInt8]) {
|
|
890
|
+
FfiConverterString.write(value.txId, into: &buf)
|
|
891
|
+
FfiConverterString.write(value.txHex, into: &buf)
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
|
|
896
|
+
#if swift(>=5.8)
|
|
897
|
+
@_documentation(visibility: private)
|
|
898
|
+
#endif
|
|
899
|
+
public func FfiConverterTypeSignedTxResult_lift(_ buf: RustBuffer) throws -> SignedTxResult {
|
|
900
|
+
return try FfiConverterTypeSignedTxResult.lift(buf)
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
#if swift(>=5.8)
|
|
904
|
+
@_documentation(visibility: private)
|
|
905
|
+
#endif
|
|
906
|
+
public func FfiConverterTypeSignedTxResult_lower(_ value: SignedTxResult) -> RustBuffer {
|
|
907
|
+
return FfiConverterTypeSignedTxResult.lower(value)
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
|
|
607
911
|
public struct TransparentInput {
|
|
608
912
|
public var txid: String
|
|
609
913
|
public var vout: UInt32
|
|
@@ -775,6 +1079,70 @@ public func FfiConverterTypeTransparentOutput_lower(_ value: TransparentOutput)
|
|
|
775
1079
|
return FfiConverterTypeTransparentOutput.lower(value)
|
|
776
1080
|
}
|
|
777
1081
|
|
|
1082
|
+
// Note that we don't yet support `indirect` for enums.
|
|
1083
|
+
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
1084
|
+
|
|
1085
|
+
public enum CardanoNetwork {
|
|
1086
|
+
|
|
1087
|
+
case mainnet
|
|
1088
|
+
case testnet
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
|
|
1092
|
+
#if swift(>=5.8)
|
|
1093
|
+
@_documentation(visibility: private)
|
|
1094
|
+
#endif
|
|
1095
|
+
public struct FfiConverterTypeCardanoNetwork: FfiConverterRustBuffer {
|
|
1096
|
+
typealias SwiftType = CardanoNetwork
|
|
1097
|
+
|
|
1098
|
+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> CardanoNetwork {
|
|
1099
|
+
let variant: Int32 = try readInt(&buf)
|
|
1100
|
+
switch variant {
|
|
1101
|
+
|
|
1102
|
+
case 1: return .mainnet
|
|
1103
|
+
|
|
1104
|
+
case 2: return .testnet
|
|
1105
|
+
|
|
1106
|
+
default: throw UniffiInternalError.unexpectedEnumCase
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
public static func write(_ value: CardanoNetwork, into buf: inout [UInt8]) {
|
|
1111
|
+
switch value {
|
|
1112
|
+
|
|
1113
|
+
|
|
1114
|
+
case .mainnet:
|
|
1115
|
+
writeInt(&buf, Int32(1))
|
|
1116
|
+
|
|
1117
|
+
|
|
1118
|
+
case .testnet:
|
|
1119
|
+
writeInt(&buf, Int32(2))
|
|
1120
|
+
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
|
|
1126
|
+
#if swift(>=5.8)
|
|
1127
|
+
@_documentation(visibility: private)
|
|
1128
|
+
#endif
|
|
1129
|
+
public func FfiConverterTypeCardanoNetwork_lift(_ buf: RustBuffer) throws -> CardanoNetwork {
|
|
1130
|
+
return try FfiConverterTypeCardanoNetwork.lift(buf)
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
#if swift(>=5.8)
|
|
1134
|
+
@_documentation(visibility: private)
|
|
1135
|
+
#endif
|
|
1136
|
+
public func FfiConverterTypeCardanoNetwork_lower(_ value: CardanoNetwork) -> RustBuffer {
|
|
1137
|
+
return FfiConverterTypeCardanoNetwork.lower(value)
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
|
|
1141
|
+
|
|
1142
|
+
extension CardanoNetwork: Equatable, Hashable {}
|
|
1143
|
+
|
|
1144
|
+
|
|
1145
|
+
|
|
778
1146
|
|
|
779
1147
|
public enum PcztError {
|
|
780
1148
|
|
|
@@ -870,6 +1238,85 @@ extension PcztError: Foundation.LocalizedError {
|
|
|
870
1238
|
}
|
|
871
1239
|
}
|
|
872
1240
|
|
|
1241
|
+
|
|
1242
|
+
public enum WalletError {
|
|
1243
|
+
|
|
1244
|
+
|
|
1245
|
+
|
|
1246
|
+
case HexError(message: String)
|
|
1247
|
+
|
|
1248
|
+
case InvalidPath(message: String)
|
|
1249
|
+
|
|
1250
|
+
case CslError(message: String)
|
|
1251
|
+
|
|
1252
|
+
case ParseError(message: String)
|
|
1253
|
+
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
|
|
1257
|
+
#if swift(>=5.8)
|
|
1258
|
+
@_documentation(visibility: private)
|
|
1259
|
+
#endif
|
|
1260
|
+
public struct FfiConverterTypeWalletError: FfiConverterRustBuffer {
|
|
1261
|
+
typealias SwiftType = WalletError
|
|
1262
|
+
|
|
1263
|
+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> WalletError {
|
|
1264
|
+
let variant: Int32 = try readInt(&buf)
|
|
1265
|
+
switch variant {
|
|
1266
|
+
|
|
1267
|
+
|
|
1268
|
+
|
|
1269
|
+
|
|
1270
|
+
case 1: return .HexError(
|
|
1271
|
+
message: try FfiConverterString.read(from: &buf)
|
|
1272
|
+
)
|
|
1273
|
+
|
|
1274
|
+
case 2: return .InvalidPath(
|
|
1275
|
+
message: try FfiConverterString.read(from: &buf)
|
|
1276
|
+
)
|
|
1277
|
+
|
|
1278
|
+
case 3: return .CslError(
|
|
1279
|
+
message: try FfiConverterString.read(from: &buf)
|
|
1280
|
+
)
|
|
1281
|
+
|
|
1282
|
+
case 4: return .ParseError(
|
|
1283
|
+
message: try FfiConverterString.read(from: &buf)
|
|
1284
|
+
)
|
|
1285
|
+
|
|
1286
|
+
|
|
1287
|
+
default: throw UniffiInternalError.unexpectedEnumCase
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
public static func write(_ value: WalletError, into buf: inout [UInt8]) {
|
|
1292
|
+
switch value {
|
|
1293
|
+
|
|
1294
|
+
|
|
1295
|
+
|
|
1296
|
+
|
|
1297
|
+
case .HexError(_ /* message is ignored*/):
|
|
1298
|
+
writeInt(&buf, Int32(1))
|
|
1299
|
+
case .InvalidPath(_ /* message is ignored*/):
|
|
1300
|
+
writeInt(&buf, Int32(2))
|
|
1301
|
+
case .CslError(_ /* message is ignored*/):
|
|
1302
|
+
writeInt(&buf, Int32(3))
|
|
1303
|
+
case .ParseError(_ /* message is ignored*/):
|
|
1304
|
+
writeInt(&buf, Int32(4))
|
|
1305
|
+
|
|
1306
|
+
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
|
|
1312
|
+
extension WalletError: Equatable, Hashable {}
|
|
1313
|
+
|
|
1314
|
+
extension WalletError: Foundation.LocalizedError {
|
|
1315
|
+
public var errorDescription: String? {
|
|
1316
|
+
String(reflecting: self)
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
|
|
873
1320
|
#if swift(>=5.8)
|
|
874
1321
|
@_documentation(visibility: private)
|
|
875
1322
|
#endif
|
|
@@ -895,6 +1342,56 @@ fileprivate struct FfiConverterSequenceUInt8: FfiConverterRustBuffer {
|
|
|
895
1342
|
}
|
|
896
1343
|
}
|
|
897
1344
|
|
|
1345
|
+
#if swift(>=5.8)
|
|
1346
|
+
@_documentation(visibility: private)
|
|
1347
|
+
#endif
|
|
1348
|
+
fileprivate struct FfiConverterSequenceTypeCardanoTxInput: FfiConverterRustBuffer {
|
|
1349
|
+
typealias SwiftType = [CardanoTxInput]
|
|
1350
|
+
|
|
1351
|
+
public static func write(_ value: [CardanoTxInput], into buf: inout [UInt8]) {
|
|
1352
|
+
let len = Int32(value.count)
|
|
1353
|
+
writeInt(&buf, len)
|
|
1354
|
+
for item in value {
|
|
1355
|
+
FfiConverterTypeCardanoTxInput.write(item, into: &buf)
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [CardanoTxInput] {
|
|
1360
|
+
let len: Int32 = try readInt(&buf)
|
|
1361
|
+
var seq = [CardanoTxInput]()
|
|
1362
|
+
seq.reserveCapacity(Int(len))
|
|
1363
|
+
for _ in 0 ..< len {
|
|
1364
|
+
seq.append(try FfiConverterTypeCardanoTxInput.read(from: &buf))
|
|
1365
|
+
}
|
|
1366
|
+
return seq
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
#if swift(>=5.8)
|
|
1371
|
+
@_documentation(visibility: private)
|
|
1372
|
+
#endif
|
|
1373
|
+
fileprivate struct FfiConverterSequenceTypeCardanoTxOutput: FfiConverterRustBuffer {
|
|
1374
|
+
typealias SwiftType = [CardanoTxOutput]
|
|
1375
|
+
|
|
1376
|
+
public static func write(_ value: [CardanoTxOutput], into buf: inout [UInt8]) {
|
|
1377
|
+
let len = Int32(value.count)
|
|
1378
|
+
writeInt(&buf, len)
|
|
1379
|
+
for item in value {
|
|
1380
|
+
FfiConverterTypeCardanoTxOutput.write(item, into: &buf)
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [CardanoTxOutput] {
|
|
1385
|
+
let len: Int32 = try readInt(&buf)
|
|
1386
|
+
var seq = [CardanoTxOutput]()
|
|
1387
|
+
seq.reserveCapacity(Int(len))
|
|
1388
|
+
for _ in 0 ..< len {
|
|
1389
|
+
seq.append(try FfiConverterTypeCardanoTxOutput.read(from: &buf))
|
|
1390
|
+
}
|
|
1391
|
+
return seq
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
|
|
898
1395
|
#if swift(>=5.8)
|
|
899
1396
|
@_documentation(visibility: private)
|
|
900
1397
|
#endif
|
|
@@ -944,6 +1441,26 @@ fileprivate struct FfiConverterSequenceTypeTransparentOutput: FfiConverterRustBu
|
|
|
944
1441
|
return seq
|
|
945
1442
|
}
|
|
946
1443
|
}
|
|
1444
|
+
public func assembleTransactionAda(rawTxHex: String, witnessSetHex: String)throws -> SignedTxResult {
|
|
1445
|
+
return try FfiConverterTypeSignedTxResult.lift(try rustCallWithError(FfiConverterTypeWalletError.lift) {
|
|
1446
|
+
uniffi_keystone_wallet_core_fn_func_assemble_transaction_ada(
|
|
1447
|
+
FfiConverterString.lower(rawTxHex),
|
|
1448
|
+
FfiConverterString.lower(witnessSetHex),$0
|
|
1449
|
+
)
|
|
1450
|
+
})
|
|
1451
|
+
}
|
|
1452
|
+
public func composeTransactionAda(inputs: [CardanoTxInput], outputs: [CardanoTxOutput], changeAddress: String, fee: UInt64, ttl: UInt64, network: CardanoNetwork)throws -> String {
|
|
1453
|
+
return try FfiConverterString.lift(try rustCallWithError(FfiConverterTypeWalletError.lift) {
|
|
1454
|
+
uniffi_keystone_wallet_core_fn_func_compose_transaction_ada(
|
|
1455
|
+
FfiConverterSequenceTypeCardanoTxInput.lower(inputs),
|
|
1456
|
+
FfiConverterSequenceTypeCardanoTxOutput.lower(outputs),
|
|
1457
|
+
FfiConverterString.lower(changeAddress),
|
|
1458
|
+
FfiConverterUInt64.lower(fee),
|
|
1459
|
+
FfiConverterUInt64.lower(ttl),
|
|
1460
|
+
FfiConverterTypeCardanoNetwork.lower(network),$0
|
|
1461
|
+
)
|
|
1462
|
+
})
|
|
1463
|
+
}
|
|
947
1464
|
public func createPczt(consensusBranchId: UInt32, expiryHeight: UInt32, coinType: UInt32)throws -> Pczt {
|
|
948
1465
|
return try FfiConverterTypePczt.lift(try rustCallWithError(FfiConverterTypePcztError.lift) {
|
|
949
1466
|
uniffi_keystone_wallet_core_fn_func_create_pczt(
|
|
@@ -962,22 +1479,52 @@ public func createTransparentPczt(inputs: [TransparentInput], outputs: [Transpar
|
|
|
962
1479
|
)
|
|
963
1480
|
})
|
|
964
1481
|
}
|
|
965
|
-
public func
|
|
966
|
-
return try FfiConverterString.lift(try rustCallWithError(
|
|
967
|
-
|
|
968
|
-
FfiConverterString.lower(
|
|
969
|
-
|
|
970
|
-
|
|
1482
|
+
public func deriveAddressByPathAda(accountXpubHex: String, path: String, network: CardanoNetwork)throws -> String {
|
|
1483
|
+
return try FfiConverterString.lift(try rustCallWithError(FfiConverterTypeWalletError.lift) {
|
|
1484
|
+
uniffi_keystone_wallet_core_fn_func_derive_address_by_path_ada(
|
|
1485
|
+
FfiConverterString.lower(accountXpubHex),
|
|
1486
|
+
FfiConverterString.lower(path),
|
|
1487
|
+
FfiConverterTypeCardanoNetwork.lower(network),$0
|
|
971
1488
|
)
|
|
972
1489
|
})
|
|
973
1490
|
}
|
|
974
|
-
public func
|
|
1491
|
+
public func deriveEnterpriseAddressByPathAda(accountXpubHex: String, path: String, network: CardanoNetwork)throws -> String {
|
|
1492
|
+
return try FfiConverterString.lift(try rustCallWithError(FfiConverterTypeWalletError.lift) {
|
|
1493
|
+
uniffi_keystone_wallet_core_fn_func_derive_enterprise_address_by_path_ada(
|
|
1494
|
+
FfiConverterString.lower(accountXpubHex),
|
|
1495
|
+
FfiConverterString.lower(path),
|
|
1496
|
+
FfiConverterTypeCardanoNetwork.lower(network),$0
|
|
1497
|
+
)
|
|
1498
|
+
})
|
|
1499
|
+
}
|
|
1500
|
+
public func derivePubkeyByPathAda(accountXpubHex: String, path: String)throws -> DerivedKeys {
|
|
1501
|
+
return try FfiConverterTypeDerivedKeys.lift(try rustCallWithError(FfiConverterTypeWalletError.lift) {
|
|
1502
|
+
uniffi_keystone_wallet_core_fn_func_derive_pubkey_by_path_ada(
|
|
1503
|
+
FfiConverterString.lower(accountXpubHex),
|
|
1504
|
+
FfiConverterString.lower(path),$0
|
|
1505
|
+
)
|
|
1506
|
+
})
|
|
1507
|
+
}
|
|
1508
|
+
public func deriveStakeAddressAda(accountXpubHex: String, network: CardanoNetwork)throws -> String {
|
|
1509
|
+
return try FfiConverterString.lift(try rustCallWithError(FfiConverterTypeWalletError.lift) {
|
|
1510
|
+
uniffi_keystone_wallet_core_fn_func_derive_stake_address_ada(
|
|
1511
|
+
FfiConverterString.lower(accountXpubHex),
|
|
1512
|
+
FfiConverterTypeCardanoNetwork.lower(network),$0
|
|
1513
|
+
)
|
|
1514
|
+
})
|
|
1515
|
+
}
|
|
1516
|
+
public func finalizeThenExtractPcztTransaction(pcztHex: String)throws -> String {
|
|
975
1517
|
return try FfiConverterString.lift(try rustCallWithError(FfiConverterTypePcztError.lift) {
|
|
976
|
-
|
|
1518
|
+
uniffi_keystone_wallet_core_fn_func_finalize_then_extract_pczt_transaction(
|
|
977
1519
|
FfiConverterString.lower(pcztHex),$0
|
|
978
1520
|
)
|
|
979
1521
|
})
|
|
980
1522
|
}
|
|
1523
|
+
public func hello() {try! rustCall() {
|
|
1524
|
+
uniffi_keystone_wallet_core_fn_func_hello($0
|
|
1525
|
+
)
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
981
1528
|
|
|
982
1529
|
private enum InitializationResult {
|
|
983
1530
|
case ok
|
|
@@ -994,16 +1541,34 @@ private var initializationResult: InitializationResult = {
|
|
|
994
1541
|
if bindings_contract_version != scaffolding_contract_version {
|
|
995
1542
|
return InitializationResult.contractVersionMismatch
|
|
996
1543
|
}
|
|
1544
|
+
if (uniffi_keystone_wallet_core_checksum_func_assemble_transaction_ada() != 22105) {
|
|
1545
|
+
return InitializationResult.apiChecksumMismatch
|
|
1546
|
+
}
|
|
1547
|
+
if (uniffi_keystone_wallet_core_checksum_func_compose_transaction_ada() != 48909) {
|
|
1548
|
+
return InitializationResult.apiChecksumMismatch
|
|
1549
|
+
}
|
|
997
1550
|
if (uniffi_keystone_wallet_core_checksum_func_create_pczt() != 11746) {
|
|
998
1551
|
return InitializationResult.apiChecksumMismatch
|
|
999
1552
|
}
|
|
1000
1553
|
if (uniffi_keystone_wallet_core_checksum_func_create_transparent_pczt() != 17127) {
|
|
1001
1554
|
return InitializationResult.apiChecksumMismatch
|
|
1002
1555
|
}
|
|
1003
|
-
if (
|
|
1556
|
+
if (uniffi_keystone_wallet_core_checksum_func_derive_address_by_path_ada() != 24523) {
|
|
1557
|
+
return InitializationResult.apiChecksumMismatch
|
|
1558
|
+
}
|
|
1559
|
+
if (uniffi_keystone_wallet_core_checksum_func_derive_enterprise_address_by_path_ada() != 54377) {
|
|
1560
|
+
return InitializationResult.apiChecksumMismatch
|
|
1561
|
+
}
|
|
1562
|
+
if (uniffi_keystone_wallet_core_checksum_func_derive_pubkey_by_path_ada() != 53793) {
|
|
1563
|
+
return InitializationResult.apiChecksumMismatch
|
|
1564
|
+
}
|
|
1565
|
+
if (uniffi_keystone_wallet_core_checksum_func_derive_stake_address_ada() != 22900) {
|
|
1566
|
+
return InitializationResult.apiChecksumMismatch
|
|
1567
|
+
}
|
|
1568
|
+
if (uniffi_keystone_wallet_core_checksum_func_finalize_then_extract_pczt_transaction() != 23392) {
|
|
1004
1569
|
return InitializationResult.apiChecksumMismatch
|
|
1005
1570
|
}
|
|
1006
|
-
if (
|
|
1571
|
+
if (uniffi_keystone_wallet_core_checksum_func_hello() != 6912) {
|
|
1007
1572
|
return InitializationResult.apiChecksumMismatch
|
|
1008
1573
|
}
|
|
1009
1574
|
if (uniffi_keystone_wallet_core_checksum_method_pczt_serialize() != 18950) {
|
package/lib/commonjs/index.js
CHANGED
|
@@ -3,8 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.CardanoNetwork = void 0;
|
|
7
|
+
exports.assembleTransactionAda = assembleTransactionAda;
|
|
8
|
+
exports.composeTransactionAda = composeTransactionAda;
|
|
6
9
|
exports.createTransparentPczt = createTransparentPczt;
|
|
7
|
-
exports.
|
|
10
|
+
exports.deriveAddressByPathAda = deriveAddressByPathAda;
|
|
11
|
+
exports.deriveEnterpriseAddressByPathAda = deriveEnterpriseAddressByPathAda;
|
|
12
|
+
exports.derivePubkeyByPathAda = derivePubkeyByPathAda;
|
|
13
|
+
exports.deriveStakeAddressAda = deriveStakeAddressAda;
|
|
14
|
+
exports.finalizeThenExtractPcztTransaction = finalizeThenExtractPcztTransaction;
|
|
8
15
|
var _reactNative = require("react-native");
|
|
9
16
|
const LINKING_ERROR = `The package 'react-native-keystone-wallet-core' doesn't seem to be linked. Make sure: \n\n` + (_reactNative.Platform.select({
|
|
10
17
|
ios: "- You have run 'pod install'\n",
|
|
@@ -18,7 +25,30 @@ const KeystoneWalletCoreModule = _reactNative.NativeModules.KeystoneWalletCoreMo
|
|
|
18
25
|
function createTransparentPczt(inputs, outputs, blockHeight) {
|
|
19
26
|
return KeystoneWalletCoreModule.createTransparentPczt(inputs, outputs, blockHeight);
|
|
20
27
|
}
|
|
21
|
-
function
|
|
22
|
-
return KeystoneWalletCoreModule.
|
|
28
|
+
function finalizeThenExtractPcztTransaction(pcztHex) {
|
|
29
|
+
return KeystoneWalletCoreModule.finalizeThenExtractPcztTransaction(pcztHex);
|
|
30
|
+
}
|
|
31
|
+
let CardanoNetwork = exports.CardanoNetwork = /*#__PURE__*/function (CardanoNetwork) {
|
|
32
|
+
CardanoNetwork["Mainnet"] = "Mainnet";
|
|
33
|
+
CardanoNetwork["Testnet"] = "Testnet";
|
|
34
|
+
return CardanoNetwork;
|
|
35
|
+
}({});
|
|
36
|
+
function derivePubkeyByPathAda(accountXpubHex, path) {
|
|
37
|
+
return KeystoneWalletCoreModule.derivePubkeyByPathAda(accountXpubHex, path);
|
|
38
|
+
}
|
|
39
|
+
function deriveAddressByPathAda(accountXpubHex, path, network) {
|
|
40
|
+
return KeystoneWalletCoreModule.deriveAddressByPathAda(accountXpubHex, path, network);
|
|
41
|
+
}
|
|
42
|
+
function deriveEnterpriseAddressByPathAda(accountXpubHex, path, network) {
|
|
43
|
+
return KeystoneWalletCoreModule.deriveEnterpriseAddressByPathAda(accountXpubHex, path, network);
|
|
44
|
+
}
|
|
45
|
+
function deriveStakeAddressAda(accountXpubHex, network) {
|
|
46
|
+
return KeystoneWalletCoreModule.deriveStakeAddressAda(accountXpubHex, network);
|
|
47
|
+
}
|
|
48
|
+
function composeTransactionAda(inputs, outputs, changeAddress, fee, ttl, network) {
|
|
49
|
+
return KeystoneWalletCoreModule.composeTransactionAda(inputs, outputs, changeAddress, fee, ttl, network);
|
|
50
|
+
}
|
|
51
|
+
function assembleTransactionAda(rawTxHex, witnessSetHex) {
|
|
52
|
+
return KeystoneWalletCoreModule.assembleTransactionAda(rawTxHex, witnessSetHex);
|
|
23
53
|
}
|
|
24
54
|
//# sourceMappingURL=index.js.map
|