You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `Peer` class also exposes the following methods: `getAllUnspentCoins`, `syncStore`, `syncStoreFromLauncherId`, `broadcastSpend`, `isCoinSpent`, `getHeaderHash`, `getFeeEstimate`, `getPeak`, `getHintedCoinStates`, `fetchServerCoin`, `getStoreCreationHeight`.
11
+
The `Peer` class also exposes the following methods: `getAllUnspentCoins`, `syncStore`, `syncStoreFromLauncherId`, `broadcastSpend`, `isCoinSpent`, `getHeaderHash`, `getFeeEstimate`, `getPeak`, `getHintedCoinStates`, `fetchServerCoin`, `getStoreCreationHeight`, `lookUpPossibleLaunchers`, `waitForCoinToBeSpent`.
12
12
13
13
Note that all functions come with detailed JSDoc comments.
* Looks up possible datastore launchers by searching for singleton launchers created with a DL-specific hint.
552
+
*
553
+
* @param {Option<u32>} lastHeight - Min. height to search records from. If null, sync will be done from the genesis block.
554
+
* @param {Buffer} headerHash - Header hash corresponding to `lastHeight`. If null, this should be the genesis challenge of the current chain.
555
+
* @returns {Promise<PossibleLaunchersResponse>} Possible launcher ids for datastores, as well as a height + header hash combo to use for the next call.
/// Looks up possible datastore launchers by searching for singleton launchers created with a DL-specific hint.
818
+
///
819
+
/// @param {Option<u32>} lastHeight - Min. height to search records from. If null, sync will be done from the genesis block.
820
+
/// @param {Buffer} headerHash - Header hash corresponding to `lastHeight`. If null, this should be the genesis challenge of the current chain.
821
+
/// @returns {Promise<PossibleLaunchersResponse>} Possible launcher ids for datastores, as well as a height + header hash combo to use for the next call.
822
+
pubasyncfnlook_up_possible_launchers(
823
+
&self,
824
+
last_height:Option<u32>,
825
+
header_hash:Buffer,
826
+
) -> napi::Result<PossibleLaunchersResponse>{
827
+
wallet::look_up_possible_launchers(
828
+
&self.inner.clone(),
829
+
last_height,
830
+
RustBytes32::from_js(header_hash)?,
831
+
)
832
+
.await
833
+
.map_err(js::err)?
834
+
.to_js()
835
+
}
836
+
837
+
#[napi]
838
+
/// Waits for a coin to be spent on-chain.
839
+
///
840
+
/// @param {Buffer} coin_id - Id of coin to track.
841
+
/// @param {Option<u32>} lastHeight - Min. height to search records from. If null, sync will be done from the genesis block.
842
+
/// @param {Buffer} headerHash - Header hash corresponding to `lastHeight`. If null, this should be the genesis challenge of the current chain.
843
+
/// @returns {Promise<Buffer>} Promise that resolves when the coin is spent (returning the coin id).
844
+
pubasyncfnwait_for_coin_to_be_spent(
845
+
&self,
846
+
coin_id:Buffer,
847
+
last_height:Option<u32>,
848
+
header_hash:Buffer,
849
+
) -> napi::Result<Buffer>{
850
+
let rust_coin_id = RustBytes32::from_js(coin_id)?;
851
+
let spent_height = wallet::subscribe_to_coin_states(
0 commit comments