Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: separate sign and send #992

Merged
merged 14 commits into from
Jun 14, 2024
Prev Previous commit
Next Next commit
docstring fixes
  • Loading branch information
BlaineHeffron committed Jun 14, 2024
commit 039c6dbbb734b015091ec077ed50ffaec7f20bab
14 changes: 6 additions & 8 deletions src/contract/assembled_transaction.ts
Original file line number Diff line number Diff line change
@@ -600,9 +600,8 @@ export class AssembledTransaction<T> {
}

/**
* Sign the transaction with the `wallet`, included previously. If you did
* not previously include one, you need to include one now that at least
* includes the `signTransaction` method.
* Sign the transaction with the signTransaction function included previously.
* If you did not previously include one, you need to include one now.
*/
sign = async ({
force = false,
@@ -678,11 +677,10 @@ export class AssembledTransaction<T> {
}

/**
* Sign the transaction with the `wallet`, included previously. If you did
* not previously include one, you need to include one now that at least
* includes the `signTransaction` method. After signing, this method will
* send the transaction to the network and return a `SentTransaction` that
* keeps track of all the attempts to fetch the transaction.
* Sign the transaction with the `signTransaction` function included previously.
* If you did not previously include one, you need to include one now.
* After signing, this method will send the transaction to the network and
* return a `SentTransaction` that keeps track * of all the attempts to fetch the transaction.
*/
signAndSend = async ({
force = false,
15 changes: 11 additions & 4 deletions src/contract/sent_transaction.ts
Original file line number Diff line number Diff line change
@@ -58,12 +58,19 @@ export class SentTransaction<T> {
}

/**
* Initialize a `SentTransaction` from an existing `AssembledTransaction` and
* a `signed` AssembledTransaction. This will also send the transaction to the
* network.
* Initialize a `SentTransaction` from `options` and a `signed`
* AssembledTransaction. This will also send the transaction to the network.
*/
static init = async <U>(
/** {@link SentTransactionOptions} from which this SentTransaction was initialized */
/**
* Configuration options for initializing the SentTransaction.
*
* @typedef {Object} SentTransactionOptions
* @property {number} [timeoutInSeconds] - Optional timeout duration in seconds for the transaction.
* @property {string} rpcUrl - The RPC URL of the network to which the transaction will be sent.
* @property {boolean} [allowHttp] - Optional flag to allow HTTP connections (default is false, HTTPS is preferred).
* @property {(xdr: xdr.ScVal) => U} parseResultXdr - Function to parse the XDR result returned by the network.
*/
options: SentTransactionOptions<U>,
/** The signed transaction to send to the network */
signed: Tx,