Constructor
new FeeBumpTransaction(envelope, networkPassphrase)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
envelope |
string
|
xdr.TransactionEnvelope
|
transaction envelope object or base64 encoded string. |
|
networkPassphrase |
string
|
passphrase of the target DigitalBits network (e.g. "LiveNet Global DigitalBits Network ; February 2021"). |
|
opts.withMuxing |
bool
|
<optional> |
indicates that the fee source of this transaction is a proper muxed account (i.e. coming from an M... address). By default, this option is disabled until muxed accounts are mature. |
Extends
Members
(readonly) fee :string
- Inherited From:
- Source:
Type:
-
string
(readonly) feeSource :string
Type:
-
string
(readonly) innerTransaction :Transaction
Type:
(readonly) networkPassphrase :string
- Inherited From:
- Source:
Type:
-
string
(readonly) signatures :
- Inherited From:
- Source:
Type:
Methods
addSignature(publicKey, signature) → {void}
Add a signature to the transaction. Useful when a party wants to pre-sign a transaction but doesn't want to give access to their secret keys. This will also verify whether the signature is valid.
Here's how you would use this feature to solicit multiple signatures.
- Use
TransactionBuilder
to build a new transaction. - Make sure to set a long enough timeout on that transaction to give your signers enough time to sign!
- Once you build the transaction, use
transaction.toXDR()
to get the base64-encoded XDR string. - Warning! Once you've built this transaction, don't submit any other transactions onto your account! Doing so will invalidate this pre-compiled transaction!
- Send this XDR string to your other parties. They can use the instructions for getKeypairSignature to sign the transaction.
- They should send you back their
publicKey
and thesignature
string from getKeypairSignature, both of which you pass to this function.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
publicKey |
string
|
The public key of the signer |
signature |
string
|
The base64 value of the signature XDR |
Returns:
- Type:
-
void
getKeypairSignature(keypair) → {string}
Signs a transaction with the given Keypair. Useful if someone sends you a transaction XDR for you to sign and return (see addSignature for more information).
When you get a transaction XDR to sign....
- Instantiate a
Transaction
object with the XDR - Use Keypair to generate a keypair object for your DigitalBits seed.
- Run
getKeypairSignature
with that keypair - Send back the signature along with your publicKey (not your secret seed!)
Example:
// `transactionXDR` is a string from the person generating the transaction
const transaction = new Transaction(transactionXDR, networkPassphrase);
const keypair = Keypair.fromSecret(myDigitalBitsSeed);
return transaction.getKeypairSignature(keypair);
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
keypair |
Keypair
|
Keypair of signer |
Returns:
- Type:
-
string
Signature string
hash() → {Buffer}
Returns a hash for this transaction, suitable for signing.
- Inherited From:
- Source:
Returns:
- Type:
-
Buffer
sign(…keypairs) → {void}
Signs the transaction with the given Keypair.
- Inherited From:
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
keypairs |
Keypair
|
<repeatable> |
Keypairs of signers |
Returns:
- Type:
-
void
signatureBase() → {Buffer}
Returns the "signature base" of this transaction, which is the value that, when hashed, should be signed to create a signature that validators on the DigitalBits Network will accept.
It is composed of a 4 prefix bytes followed by the xdr-encoded form of this transaction.
Returns:
- Type:
-
Buffer
signHashX(preimage) → {void}
Add hashX
signer preimage as signature.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
preimage |
Buffer
|
String
|
Preimage of hash used as signer |
Returns:
- Type:
-
void
toEnvelope() → {xdr.TransactionEnvelope}
To envelope returns a xdr.TransactionEnvelope which can be submitted to the network.
Returns:
- Type:
-
xdr.TransactionEnvelope
toXDR() → {string}
Get the transaction envelope as a base64-encoded string
- Inherited From:
- Source:
Returns:
- Type:
-
string
XDR string