@bennyblader/ddk-rn 0.3.3 → 0.3.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bennyblader/ddk-rn",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "dlcdevkit bindings for react-native",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/commonjs/index.js",
@@ -165,6 +165,16 @@ interface NativeModuleInterface {
165
165
  msgs: Uint8Array,
166
166
  uniffi_out_err: UniffiRustCallStatus
167
167
  ): number;
168
+ ubrn_uniffi_ddk_ffi_fn_func_verify_cet_adaptor_sigs_from_oracle_info(
169
+ adaptorSigs: Uint8Array,
170
+ cets: Uint8Array,
171
+ oracleInfo: Uint8Array,
172
+ pubkey: Uint8Array,
173
+ fundingScriptPubkey: Uint8Array,
174
+ totalCollateral: bigint,
175
+ msgs: Uint8Array,
176
+ uniffi_out_err: UniffiRustCallStatus
177
+ ): number;
168
178
  ubrn_uniffi_ddk_ffi_fn_func_verify_fund_tx_signature(
169
179
  fundTx: Uint8Array,
170
180
  signature: Uint8Array,
@@ -195,6 +205,7 @@ interface NativeModuleInterface {
195
205
  ubrn_uniffi_ddk_ffi_checksum_func_sign_cet(): number;
196
206
  ubrn_uniffi_ddk_ffi_checksum_func_sign_fund_transaction_input(): number;
197
207
  ubrn_uniffi_ddk_ffi_checksum_func_verify_cet_adaptor_sig_from_oracle_info(): number;
208
+ ubrn_uniffi_ddk_ffi_checksum_func_verify_cet_adaptor_sigs_from_oracle_info(): number;
198
209
  ubrn_uniffi_ddk_ffi_checksum_func_verify_fund_tx_signature(): number;
199
210
  ubrn_uniffi_ddk_ffi_checksum_func_version(): number;
200
211
  ubrn_ffi_ddk_ffi_uniffi_contract_version(): number;
package/src/ddk_ffi.ts CHANGED
@@ -191,7 +191,7 @@ export function createCets(
191
191
  fundVout: /*u32*/ number,
192
192
  localFinalScriptPubkey: Array</*u8*/ number>,
193
193
  remoteFinalScriptPubkey: Array</*u8*/ number>,
194
- outcomes: Array<DlcOutcome>,
194
+ outcomes: Array<Payout>,
195
195
  lockTime: /*u32*/ number,
196
196
  localSerialId: /*u64*/ bigint,
197
197
  remoteSerialId: /*u64*/ bigint
@@ -210,7 +210,7 @@ export function createCets(
210
210
  FfiConverterUInt32.lower(fundVout),
211
211
  FfiConverterArrayUInt8.lower(localFinalScriptPubkey),
212
212
  FfiConverterArrayUInt8.lower(remoteFinalScriptPubkey),
213
- FfiConverterArrayTypeDlcOutcome.lower(outcomes),
213
+ FfiConverterArrayTypePayout.lower(outcomes),
214
214
  FfiConverterUInt32.lower(lockTime),
215
215
  FfiConverterUInt64.lower(localSerialId),
216
216
  FfiConverterUInt64.lower(remoteSerialId),
@@ -222,7 +222,7 @@ export function createCets(
222
222
  );
223
223
  }
224
224
  export function createDlcTransactions(
225
- outcomes: Array<DlcOutcome>,
225
+ outcomes: Array<Payout>,
226
226
  localParams: PartyParams,
227
227
  remoteParams: PartyParams,
228
228
  refundLocktime: /*u32*/ number,
@@ -242,7 +242,7 @@ export function createDlcTransactions(
242
242
  return nativeModule()
243
243
  .ubrn_uniffi_ddk_ffi_fn_func_create_dlc_transactions;
244
244
  })()(
245
- FfiConverterArrayTypeDlcOutcome.lower(outcomes),
245
+ FfiConverterArrayTypePayout.lower(outcomes),
246
246
  FfiConverterTypePartyParams.lower(localParams),
247
247
  FfiConverterTypePartyParams.lower(remoteParams),
248
248
  FfiConverterUInt32.lower(refundLocktime),
@@ -318,7 +318,7 @@ export function createRefundTransaction(
318
318
  );
319
319
  }
320
320
  export function createSplicedDlcTransactions(
321
- outcomes: Array<DlcOutcome>,
321
+ outcomes: Array<Payout>,
322
322
  localParams: PartyParams,
323
323
  remoteParams: PartyParams,
324
324
  refundLocktime: /*u32*/ number,
@@ -340,7 +340,7 @@ export function createSplicedDlcTransactions(
340
340
  return nativeModule()
341
341
  .ubrn_uniffi_ddk_ffi_fn_func_create_spliced_dlc_transactions;
342
342
  })()(
343
- FfiConverterArrayTypeDlcOutcome.lower(outcomes),
343
+ FfiConverterArrayTypePayout.lower(outcomes),
344
344
  FfiConverterTypePartyParams.lower(localParams),
345
345
  FfiConverterTypePartyParams.lower(remoteParams),
346
346
  FfiConverterUInt32.lower(refundLocktime),
@@ -589,6 +589,39 @@ export function verifyCetAdaptorSigFromOracleInfo(
589
589
  )
590
590
  );
591
591
  }
592
+ export function verifyCetAdaptorSigsFromOracleInfo(
593
+ adaptorSigs: Array<AdaptorSignature>,
594
+ cets: Array<Transaction>,
595
+ oracleInfo: Array<OracleInfo>,
596
+ pubkey: Array</*u8*/ number>,
597
+ fundingScriptPubkey: Array</*u8*/ number>,
598
+ totalCollateral: /*u64*/ bigint,
599
+ msgs: Array<Array<Array</*u8*/ number>>>
600
+ ): boolean {
601
+ return FfiConverterBool.lift(
602
+ uniffiCaller.rustCall(
603
+ /*caller:*/ (callStatus) => {
604
+ return (() => {
605
+ console.debug(
606
+ `-- uniffi_ddk_ffi_fn_func_verify_cet_adaptor_sigs_from_oracle_info`
607
+ );
608
+ return nativeModule()
609
+ .ubrn_uniffi_ddk_ffi_fn_func_verify_cet_adaptor_sigs_from_oracle_info;
610
+ })()(
611
+ FfiConverterArrayTypeAdaptorSignature.lower(adaptorSigs),
612
+ FfiConverterArrayTypeTransaction.lower(cets),
613
+ FfiConverterArrayTypeOracleInfo.lower(oracleInfo),
614
+ FfiConverterArrayUInt8.lower(pubkey),
615
+ FfiConverterArrayUInt8.lower(fundingScriptPubkey),
616
+ FfiConverterUInt64.lower(totalCollateral),
617
+ FfiConverterArrayArrayArrayUInt8.lower(msgs),
618
+ callStatus
619
+ );
620
+ },
621
+ /*liftString:*/ FfiConverterString.lift
622
+ )
623
+ );
624
+ }
592
625
  export function verifyFundTxSignature(
593
626
  fundTx: Transaction,
594
627
  signature: Array</*u8*/ number>,
@@ -837,64 +870,6 @@ const FfiConverterTypeDlcInputInfo = (() => {
837
870
  return new FFIConverter();
838
871
  })();
839
872
 
840
- export type DlcOutcome = {
841
- localPayout: /*u64*/ bigint;
842
- remotePayout: /*u64*/ bigint;
843
- };
844
-
845
- /**
846
- * Generated factory for {@link DlcOutcome} record objects.
847
- */
848
- export const DlcOutcome = (() => {
849
- const defaults = () => ({});
850
- const create = (() => {
851
- return uniffiCreateRecord<DlcOutcome, ReturnType<typeof defaults>>(
852
- defaults
853
- );
854
- })();
855
- return Object.freeze({
856
- /**
857
- * Create a frozen instance of {@link DlcOutcome}, with defaults specified
858
- * in Rust, in the {@link ddk_ffi} crate.
859
- */
860
- create,
861
-
862
- /**
863
- * Create a frozen instance of {@link DlcOutcome}, with defaults specified
864
- * in Rust, in the {@link ddk_ffi} crate.
865
- */
866
- new: create,
867
-
868
- /**
869
- * Defaults specified in the {@link ddk_ffi} crate.
870
- */
871
- defaults: () => Object.freeze(defaults()) as Partial<DlcOutcome>,
872
- });
873
- })();
874
-
875
- const FfiConverterTypeDlcOutcome = (() => {
876
- type TypeName = DlcOutcome;
877
- class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
878
- read(from: RustBuffer): TypeName {
879
- return {
880
- localPayout: FfiConverterUInt64.read(from),
881
- remotePayout: FfiConverterUInt64.read(from),
882
- };
883
- }
884
- write(value: TypeName, into: RustBuffer): void {
885
- FfiConverterUInt64.write(value.localPayout, into);
886
- FfiConverterUInt64.write(value.remotePayout, into);
887
- }
888
- allocationSize(value: TypeName): number {
889
- return (
890
- FfiConverterUInt64.allocationSize(value.localPayout) +
891
- FfiConverterUInt64.allocationSize(value.remotePayout)
892
- );
893
- }
894
- }
895
- return new FFIConverter();
896
- })();
897
-
898
873
  export type DlcTransactions = {
899
874
  fund: Transaction;
900
875
  cets: Array<Transaction>;
@@ -1927,16 +1902,16 @@ const FfiConverterArrayTypeDlcInputInfo = new FfiConverterArray(
1927
1902
  FfiConverterTypeDlcInputInfo
1928
1903
  );
1929
1904
 
1930
- // FfiConverter for Array<DlcOutcome>
1931
- const FfiConverterArrayTypeDlcOutcome = new FfiConverterArray(
1932
- FfiConverterTypeDlcOutcome
1933
- );
1934
-
1935
1905
  // FfiConverter for Array<OracleInfo>
1936
1906
  const FfiConverterArrayTypeOracleInfo = new FfiConverterArray(
1937
1907
  FfiConverterTypeOracleInfo
1938
1908
  );
1939
1909
 
1910
+ // FfiConverter for Array<Payout>
1911
+ const FfiConverterArrayTypePayout = new FfiConverterArray(
1912
+ FfiConverterTypePayout
1913
+ );
1914
+
1940
1915
  // FfiConverter for Array<Transaction>
1941
1916
  const FfiConverterArrayTypeTransaction = new FfiConverterArray(
1942
1917
  FfiConverterTypeTransaction
@@ -2022,7 +1997,7 @@ function uniffiEnsureInitialized() {
2022
1997
  );
2023
1998
  }
2024
1999
  if (
2025
- nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_create_cets() !== 45293
2000
+ nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_create_cets() !== 50529
2026
2001
  ) {
2027
2002
  throw new UniffiInternalError.ApiChecksumMismatch(
2028
2003
  'uniffi_ddk_ffi_checksum_func_create_cets'
@@ -2030,7 +2005,7 @@ function uniffiEnsureInitialized() {
2030
2005
  }
2031
2006
  if (
2032
2007
  nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_create_dlc_transactions() !==
2033
- 9500
2008
+ 29518
2034
2009
  ) {
2035
2010
  throw new UniffiInternalError.ApiChecksumMismatch(
2036
2011
  'uniffi_ddk_ffi_checksum_func_create_dlc_transactions'
@@ -2054,7 +2029,7 @@ function uniffiEnsureInitialized() {
2054
2029
  }
2055
2030
  if (
2056
2031
  nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_create_spliced_dlc_transactions() !==
2057
- 51059
2032
+ 19497
2058
2033
  ) {
2059
2034
  throw new UniffiInternalError.ApiChecksumMismatch(
2060
2035
  'uniffi_ddk_ffi_checksum_func_create_spliced_dlc_transactions'
@@ -2128,6 +2103,14 @@ function uniffiEnsureInitialized() {
2128
2103
  'uniffi_ddk_ffi_checksum_func_verify_cet_adaptor_sig_from_oracle_info'
2129
2104
  );
2130
2105
  }
2106
+ if (
2107
+ nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_verify_cet_adaptor_sigs_from_oracle_info() !==
2108
+ 37581
2109
+ ) {
2110
+ throw new UniffiInternalError.ApiChecksumMismatch(
2111
+ 'uniffi_ddk_ffi_checksum_func_verify_cet_adaptor_sigs_from_oracle_info'
2112
+ );
2113
+ }
2131
2114
  if (
2132
2115
  nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_verify_fund_tx_signature() !==
2133
2116
  27316
@@ -2150,7 +2133,6 @@ export default Object.freeze({
2150
2133
  FfiConverterTypeChangeOutputAndFees,
2151
2134
  FfiConverterTypeDLCError,
2152
2135
  FfiConverterTypeDlcInputInfo,
2153
- FfiConverterTypeDlcOutcome,
2154
2136
  FfiConverterTypeDlcTransactions,
2155
2137
  FfiConverterTypeExtendedKey,
2156
2138
  FfiConverterTypeOracleInfo,