This is a stub types definition for stellar-base (https://github.com/stellar/js-stellar-base).
stellar-base provides its own type definitions, so you don't need @types/stellar-base installed!
This is a stub types definition. stellar-base provides its own type definitions, so you do not need this installed.
Stub TypeScript definitions entry for stellar-base, which provides its own types definitions
This is a stub types definition for stellar-base (https://github.com/stellar/js-stellar-base).
stellar-base provides its own type definitions, so you don't need @types/stellar-base installed!
v14.0.2:v14.0.1:Asset.toString() TypeScript definition (#1218).v14.0.0: Protocol 23sodium-native and tweetnacl dependencies have been replaced with @noble/curves (#802).StrKey (#799).Address (#801).nativeToScVal to convert arrays with differing types to smart contract values, e.g., nativeToScVal([1, "x", "y"], { type: [ "i128", "symbol" ]}) will give you a Vec<i128, symbol, string> (#803).Buffer.subarray polyfill introduced in #733 in v11.0.1 as a workaround for React Native's Hermes engine. Please use @exodus/patch-broken-hermes-typed-arrays as an alternative, if needed (#795).MuxedAccount.parseBaseAddress from TypeScript definitions (#797).v14.0.0-rc.2Address.toScAddress() that would prevent claimable balances and muxed accounts from being encoded correctly.v14.0.0-rc.1: Protocol 23sodium-native and tweetnacl dependencies have been replaced with @noble/curves (#802).StrKey (#799).Address (#801).nativeToScVal to convert arrays with differing types to smart contract values, e.g., nativeToScVal([1, "x", "y"], { type: [ "i128", "symbol" ]}) will give you a Vec<i128, symbol, string> (#803).Buffer.subarray polyfill introduced in #733 in v11.0.1 as a workaround for React Native's Hermes engine. Please use @exodus/patch-broken-hermes-typed-arrays as an alternative, if needed (#795).MuxedAccount.parseBaseAddress from TypeScript definitions (#797).v13.1.0nativeToScVal now supports encoding Keypairs as addresses (#794).authorizeEntry, the SigningCallback callback function should now return an object containing both the signature and the identity of the signer. In multi-signature situations, it isn't necessarily the case that the address within the authorization entry is the one that actually signs that entry. Thus, the callback now takes the following form, where the original Promise<BufferLike> option is preserved for backwards compatibility and should be considered deprecated (#783):export type SigningCallback = (
preimage: xdr.HashIdPreimage
) => Promise<BufferLike | { signature: BufferLike; publicKey: string }>;scValToNative will decode addresses more efficiently and reliably (#794).v13.0.1buildInvocationTree will now successfully walk creation invocations with constructor arguments (#784).v13.0.0This release supports Protocol 22. While the network has not upgraded yet, you can start integrating the new features into your codebase if you want a head start. Keep in mind that while the binary XDR is backwards-compatible, the naming and layout of structures is not. In other words, this build will continue to work on Protocol 21, but you may have to update code that references XDR directly.
This version is unchanged from beta.1.
v13.0.0-beta.1This is the first release that supports Protocol 22. While the network has not upgraded yet, you can start integrating the new features into your codebase if you want a head start. Keep in mind that while the binary XDR is backwards-compatible, the naming and layout of structures is not. In other words, this build will continue to work on Protocol 21, but you may have to update code that references XDR directly.
Operation.createCustomContract, constructorArgs: xdr.ScVal[] (#770).v12.1.1walkInvocationTree to allow void returns on the callback function as intended rather than forcing a return null (#765).authorizeEntry to use the correct public key when passing Keypairs (#772).v12.1.0TransactionBuilder now has addOperationAt and clearOperationAt methods to allow manipulation of individual operations (#757).nativeToScVal now correctly sorts maps lexicographically based on the keys to match what the Soroban environment expects (#759).nativeToScVal now allows all integer types to come from strings (#763).humanizeEvents now handles events without a contractId set more reliably (#764).v12.0.1StrKey.isValidContract (#751).scValToNative would fail when the values contained error codes because the parsing routine hadn't been updated to the new error schemas. Errors are now converted to the following format (#753):interface Error {
type: "contract" | "system";
code: number;
value?: string; // only present for type === 'system'
}You can refer to the XDR documentation for additional explanations for each error code.
v12.0.0This is a re-tag of v12.0.0-rc.1 with only developer dependency updates in-between.
v12.0.0-rc.11a04392 (#738).cereal.XdrWriter and cereal.XdrReader which come directly from @stellar/js-xdr (#744).Buffer and Uint8Array compatibility has improved in StrKey (#746).v11.0.1Buffer.subarray polyfill (#733).@stellar/js-xdr which should broaden compatibility to pre-ES2016 environments (#734, #735).v11.0.0Note: This version is (still) compatible with Protocol 20. Most people should be unaffected by the technically-breaking changes below and can treat this more like a v10.0.3 patch release.
BigNumber.DEBUG in bignumber.js to true internally, which affects all code using BigNumber. This behavior has been fixed and only affects this library: globally, BigNumber.DEBUG now remains at its default setting (i.e. disabled). This is technically a breaking behavior change and is released as such (#729).v10.0.2contractId field is correctly omitted from humanized events when it wasn't present in the structure (#721).v10.0.1Asset.contractId() now includes a missing parameter (the networkPassphrase changes the ID for a contract; #718).v10.0.0: Protocol 20 Stable ReleaseXDR has been upgraded to the latest stable version (stellar-xdr@6a620d1). This is mostly renames, but it includes the following relevant breaking changes (#704):
Operation.bumpFootprintExpiration is now extendFootprintTtl and its ledgersToExpire field is now named extendTo, but it serves the same purpose.Operation.BumpFootprintExpiration is now Operation.ExtendFootprintTTLxdr.ContractExecutable.contractExecutableToken is now contractExecutableStellarAssetxdr.SorobanTransactionData.refundableFee is now resourceFeeSorobanDataBuilder.setRefundableFee is now setResourceFeeTransactionBuilder(..., { fee: ... })).Contract.getFootprint() now only returns a single result: the ledger key of the deployed instance for the given ID, because the key for the code entry was incorrect (it should not be the ID but rather the WASM hash, which is not calculatable w/o network access) (#709).
v10.0.0-beta.4TransactionBuilder.cloneFrom) with large sequence numbers (#711).v10.0.0-beta.3authorizeEntry might perform a no-op when it shouldn't (#701).Memo.hash did not accept a Buffer (#698).v10.0.0-beta.2The wrappers around multi-party authorization have changed (#678):
authorizeEntry has been added to help sign auth entries in-place
authorizeInvocation has changed: it now offers a callback approach by default and requires slightly different parametersbuildAuthEntry, buildAuthEnvelope, and authorizeInvocationCallback have been removedv10.0.0-beta.1nativeToScVal now allows anything to be passed to the opts.type specifier. Previously, it was only integer types (#691).Contract.call() now produces valid Operation XDR (#692).v10.0.0-beta.0: Protocol 20The core data structure of Soroban is a generic type called an ScVal (s*mart *contract value, which is a union of types that can basically represent anything [numbers, strings, arrays, maps, contract bytecode, etc.]). You can refer to the XDR for details, and you can utilize new APIs to make dealing with these complex values easier:
nativeToScVal helps convert native types to their closest Soroban equivalentscValToNative helps find the closest native JavaScript type(s) corresponding to a smart contract valuescValToBigInt helps convert numeric ScVals into native bigintsScInt and XdrLargeInt help convert to and from bigints to other types and form sized integer types for smart contract usageThe following are new APIs to deal with new Soroban constructs:
Address, which helps manage "smart" addresses in the Soroban context. Addresses there (used for auth and identity purposes) can either be contracts (strkey C...) or accounts (strkey G...). This abstraction helps manage them and distinguish between them easily.Contract, which helps manage contract identifiers. The primary purpose is to build invocations of its methods via the generic call(...), but it also provides utilities for converting to an Address or calculating its minimum footprint for state expiration.invokeHostFunction for calling contract codebumpFootprintExpiration for extending the state lifetime of Soroban datarestoreFootprint for restoring expired, off-chain state back onto the ledgerTransactionBuilder now takes a sorobanData parameter (and has a corresponding .setSorobanData() builder method) which primarily describes the storage footprint of a Soroban (that is, which parts of the ledger state [in the form of xdr.LedgerKeys] it plans to read and write as part of the transaction).SorobanDataBuilder factory to set fields individuallyTransactionBuilder now has a cloneFrom(tx, opts) constructor method to create an instance from an existing transaction, also allowing parameter overrides via opts.buildInvocationTree and walkInvocationTree are both ways to visualize invocation calling trees betterauthorizeInvocation helps multiple parties sign invocation calling treeshumanizeEvents helps make diagnostic events more readableThis is a large update and the following changelog incorporates ALL changes across the beta.N versions of this upgrade.
This version is marked by a major version bump because of the significant upgrades to underlying dependencies. While there should be no noticeable API changes from a downstream perspective, there may be breaking changes in the way that this library is bundled.
The browser bundle size has decreased significantly:
stellar-base.min.js is 340 KiB, down from 1.2 MiB previously.stellar-base.js is 895 KiB.Though we have tried to maintain compatibility with older JavaScript implementations, this still means you may need to update your build pipeline to transpile to certain targets.
curr and next versions, #587).lodash dependency entirely (#624).crc dependency and inline it to lower bundle size (#621).crc dependency and inline it to lower bundle size (#621).js-xdr dependency (major performance improvements, see js-xdr@v2.0.0) and other dependencies to their latest versions (#592).xdr.Operations (#591).This version is marked by a major version bump because of the significant upgrades to underlying dependencies. While there should be no noticeable API changes from a downstream perspective, there may be breaking changes in the way that this library is bundled.
Build system has been overhauled to support Webpack 5 (#585).
Current and vNext XDR updated to latest versions (#587).
XLM (#546).Operation.setOptions now supports the new CAP-40 signed payload signer (ed25519SignedPayload) thanks to @orbitlens (#542).TransactionBase.addDecoratedSignature is a clearer way to add signatures directly to a built transaction without fiddling with the underlying signatures array (#535).
Update the XDR definitions (and the way in which they're generated) to contain both the latest current XDR (which introduces CAP-42) and the "v-next" XDR (which contains XDR related to Soroban and should be considered unstable) (#537).
minAccountSequence in TransactionBuilder for large values (#539, thank you @overcat!).This is a promotion from the beta version without changes, now that the CAP-21 and CAP-40 implementations have made it into stellar/stellar-core#master.
This release adds support for Protocol 19, which includes CAP-21 (new transaction preconditions) and CAP-40 (signed payload signers).
This is considered a beta release until the XDR for the Stellar protocol stabilizes and is officially released.
As of this release, the minimum supported version of NodeJS is 14.x.
xdr.OperationId is now xdr.HashIdPreimagexdr.OperationIdId is now xdr.HashIdPreimageOperationIdSupport for converting signed payloads (CAP-40) to and from their StrKey (P...) representation (#511):
Keypair.signPayloadDecorated(data)StrKey.encodeSignedPayload(buf)StrKey.decodeSignedPayload(str)StrKey.isValidSignedPayload(str)Support for creating transactions with the new preconditions (CAP-21) via TransactionBuilder (#513).
A way to convert between addresses (like G... and P..., i.e. the StrKey class) and their respective signer keys (i.e. xdr.SignerKeys), particularly for use in the new transaction preconditions (#520):
SignerKey.decodeAddress(address)SignerKey.encodeSignerKey(address)TransactionBuilder.setTimebounds(min, max)TransactionBuilder.setLedgerbounds(min, max)TransactionBuilder.setMinAccountSequence(seq)TransactionBuilder.setMinAccountSequenceAge(age)TransactionBuilder.setMinAccountSequenceLedgerGap(gap)TransactionBuilder.setExtraSigners([signers])Correct a TypeScript definition on the RevokeLiquidityPoolSponsorship operation (#522).
Resolves a bug that incorrectly sorted Assets with mixed-case asset codes (it preferred lowercase codes incorrectly) (#516).
Update developer dependencies:
This release introduces unconditional support for muxed accounts (#485).
In v5.2.0, we introduced opt-in support for muxed accounts, where you would need to explicitly pass a true flag if you wanted to interpret muxed account objects as muxed addresses (in the form M..., see SEP-23). We stated that this would become the default in the future. That is now the case.
The following fields will now always support muxed properties:
FeeBumpTransaction.feeSourceTransaction.sourceAccountOperation.sourceAccountPayment.destinationPathPaymentStrictReceive.destinationPathPaymentStrictSend.destinationAccountMerge.destinationClawback.fromThe following functions had a withMuxing parameter removed:
Operation.fromXDRObjectTransaction.constructorFeeBumpTransaction.constructorTransactionBuilder.fromXDRTransactionBuilder.buildFeeBumpTransactionThe following functions will no longer check the opts object for a withMuxing field:
TransactionBuilder.constructorOperation.setSourceAccountThere are several other breaking changes:
TransactionBuilder.enableMuxedAccounts() is removeddecodeAddressToMuxedAccount() and encodeMuxedAccountToAddress() no longer accept a second boolean parameterAccount.createSubaccount() and MuxedAccount.createSubaccount() are removed (#487). You should prefer to create them manually:let mux1 = new MuxedAccount(someAccount, "1");
// before:
let mux2 = mux1.createSubaccount("2");
// now:
let mux2 = new MuxedAccount(mux1.baseAccount(), "2");function extractBaseAddess(address: string): string;namespace StrKey {
function encodeMed25519PublicKey(data: Buffer): string;
function decodeMed25519PublicKey(data: string): Buffer;
function isValidMed25519PublicKey(publicKey: string): boolean;
}
function decodeAddressToMuxedAccount(
address: string,
supportMuxing: boolean
): xdr.MuxedAccount;
function encodeMuxedAccountToAddress(
account: xdr.MuxedAccount,
supportMuxing: boolean
): string;
function encodeMuxedAccount(gAddress: string, id: string): xdr.MuxedAccount;Transaction.getClaimableBalanceId(int) which lets you pre-determine the hex claimable balance ID of a createClaimableBalance operation prior to submission to the network (#482).Buffer as a parameter type option for the Keypair constructor in Typescript (#484).This version bump fixes a security vulnerability in a developer dependency; please upgrade as soon as possible! You may be affected if you are working on this package in a developer capacity (i.e. you've cloned this repository) and have run yarn or yarn install any time on Oct 22nd, 2021.
Please refer to the security advisory for details.
ua-parser-js to a known safe version (#477).TransactionBuilder.fromXDR() (#470).Transaction, forward the optional withMuxing flag along to its operations so that their properties are also decoded with the appropriate muxing state (#469).withMuxing flag (#466).LiquidityPoolDepositOp and LiquidityPoolWithdrawOp.LiquidityPoolId and LiquidityPoolAsset.Operation class with the Operation.revokeLiquidityPoolSponsorship helper that allows revoking a liquidity pool sponsorship.AssetType.liquidityPoolShares.Operation.changeTrust and ChangeTrustOp can now use LiquidityPoolAsset in addition to Asset.Operation.revokeTrustlineSponsorship can now use LiquidityPoolId in addition to Asset.lodash (#449).M... form) as the first parameter (and explicitly opt-in to muxing by passing true as the last parameter) to TransactionBuilder.buildFeeBumpTransaction to make the feeSource a fully-muxed account instance (#434).Opt-in support for muxed accounts. This introduces M... addresses from SEP-23, which multiplex a Stellar G... address across IDs to eliminate the need for ad-hoc multiplexing via the Transaction.memo field (see the relevant SEP-29 and blog post on the topic). The following operations now support muxed accounts (#416):
Payment.destinationPathPaymentStrictReceive.destinationPathPaymentStrictSend.destinationOperation.sourceAccountAccountMerge.destinationTransaction.sourceAccountThe above changeset also introduces a new high-level object, MuxedAccount (not to be confused with xdr.MuxedAccount, which is the underlying raw representation) to make working with muxed accounts easier. You can use it to easily create and manage muxed accounts and their underlying shared Account, passing them along to the supported operations and TransactionBuilder (#416):
const PUBKEY = "GA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJVSGZ";
const ACC = new StellarBase.Account(PUBKEY, "1");
const mux1 = new StellarBase.MuxedAccount(ACC, "1000");
console.log(mux1.accountId(), mux1.id());
// MA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJUAAAAAAAAAAD5DTGC 1000
const mux2 = ACC.createSubaccount("2000");
console.log(
"Parent relationship preserved:",
mux2.baseAccount().accountId() === mux1.baseAccount().accountId()
);
console.log(mux2.accountId(), mux2.id());
// MA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJUAAAAAAAAAAH2B4RU 2000
mux1.setID("3000");
console.log(
"Underlying account unchanged:",
ACC.accountId() === mux1.baseAccount().accountId()
);
console.log(mux1.accountId(), mux1.id());
// MA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJUAAAAAAAAAALXC5LE 3000SetOptions to use authorization flags (e.g. AuthRequiredFlag) correctly (#418).ClawbackOp, ClawbackClaimableBalanceOp, and SetTrustLineFlagsOp (#397).Add an additional parameter check to claimClaimableBalance to fail faster (#390).
The XDR definitions have been updated to support CAP-35 (#394).
AllowTrustOpAsset has been renamed to AssetCode (#394)AllowTrustOp is now a deprecated operation.createAccount operation to accept 0 as the starting balance (#375).Claimant class which helps the creation of claimable balances. (#367).
The default behavior of this class it to create claimants with an unconditional predicate if none is passed:const claimant = new StellarBase.Claimant(
'GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ'
);However, you can use any of the following helpers to create a predicate:
StellarBase.Claimant.predicateUnconditional();
StellarBase.Claimant.predicateAnd(left, right);
StellarBase.Claimant.predicateOr(left, right);
StellarBase.Claimant.predicateNot(predicate);
StellarBase.Claimant.predicateBeforeAbsoluteTime(unixEpoch);
StellarBase.Claimant.predicateBeforeRelativeTime(seconds);And then pass the predicate in the constructor:
const left = StellarBase.Claimant.predicateBeforeRelativeTime('800');
const right = StellarBase.Claimant.predicateBeforeRelativeTime(
'1200'
);
const predicate = StellarBase.Claimant.predicateOr(left, right);
const claimant = new StellarBase.Claimant(
'GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ',
predicate
);Operation.createClaimableBalance (#368)
Extend the operation class with a new helper to create claimable balance operations.const asset = new Asset(
"USD",
"GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7"
);
const amount = "100.0000000";
const claimants = [
new Claimant(
"GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ",
Claimant.predicateBeforeAbsoluteTime("4102444800000")
),
];
const op = Operation.createClaimableBalance({
asset,
amount,
claimants,
});Operation.claimClaimableBalance (#368)
Extend the operation class with a new helper to create claim claimable balance operations. It receives the balanceId as exposed by Horizon in the /claimable_balances end-point.const op = Operation.createClaimableBalance({
balanceId:
"00000000da0d57da7d4850e7fc10d2a9d0ebc731f7afb40574c03395b17d49149b91f5be",
});Extend the operation class with helpers that allow sponsoring reserves and also revoke sponsorships.
To start sponsoring reserves for an account use:
Operation.beginSponsoringFutureReservesOperation.endSponsoringFutureReservesTo revoke a sponsorship after it has been created use any of the following helpers:
Operation.revokeAccountSponsorshipOperation.revokeTrustlineSponsorshipOperation.revokeOfferSponsorshipOperation.revokeDataSponsorshipOperation.revokeClaimableBalanceSponsorshipOperation.revokeSignerSponsorshipThe following example contains a transaction which sponsors operations for an account and then revoke some sponsorships.
const transaction = new StellarSdk.TransactionBuilder(account, {
fee: "100",
networkPassphrase: StellarSdk.Networks.TESTNET
})
.addOperation(
StellarSdk.Operation.beginSponsoringFutureReserves({
sponsoredId: account.accountId(),
source: masterKey.publicKey()
})
)
.addOperation(
StellarSdk.Operation.accountMerge({ destination: destKey.publicKey() }),
).addOperation(
StellarSdk.Operation.createClaimableBalance({
amount: "10",
asset: StellarSdk.Asset.native(),
claimants: [
new StellarSdk.Claimant(account.accountId())
]
}),
).addOperation(
StellarSdk.Operation.claimClaimableBalance({
balanceId: "00000000da0d57da7d4850e7fc10d2a9d0ebc731f7afb40574c03395b17d49149b91f5be",
}),
).addOperation(
StellarSdk.Operation.endSponsoringFutureReserves({
})
).addOperation(
StellarSdk.Operation.revokeAccountSponsorship({
account: account.accountId(),
})
).addOperation(
StellarSdk.Operation.revokeTrustlineSponsorship({
account: account.accountId(),
asset: usd,
})
).addOperation(
StellarSdk.Operation.revokeOfferSponsorship({
seller: account.accountId(),
offerId: '12345'
})
).addOperation(
StellarSdk.Operation.revokeDataSponsorship({
account: account.accountId(),
name: 'foo'
})
).addOperation(
StellarSdk.Operation.revokeClaimableBalanceSponsorship({
balanceId: "00000000da0d57da7d4850e7fc10d2a9d0ebc731f7afb40574c03395b17d49149b91f5be",
})
).addOperation(
StellarSdk.Operation.revokeSignerSponsorship({
account: account.accountId(),
signer: {
ed25519PublicKey: sourceKey.publicKey()
}
})
).addOperation(
StellarSdk.Operation.revokeSignerSponsorship({
account: account.accountId(),
signer: {
sha256Hash: "da0d57da7d4850e7fc10d2a9d0ebc731f7afb40574c03395b17d49149b91f5be"
}
})
).addOperation(
StellarSdk.Operation.revokeSignerSponsorship({
account: account.accountId(),
signer: {
preAuthTx: "da0d57da7d4850e7fc10d2a9d0ebc731f7afb40574c03395b17d49149b91f5be"
}
})
).build();The following functions were renamed:
xdr.OperationBody.setOption() -> xdr.OperationBody.setOptions()xdr.OperationBody.manageDatum() -> xdr.OperationBody.manageData()xdr.OperationType.setOption() -> xdr.OperationType.setOptions()xdr.OperationType.manageDatum() -> xdr.OperationType.manageData()The following enum values were rename in OperationType:
setOption -> setOptionsmanageDatum -> manageDatafiles in npm package to include XDR type definitions (#345).This version brings protocol 13 support with backwards compatibility support for protocol 12.
TransactionBuilder.buildFeeBumpTransaction which makes it easy to create FeeBumpTransaction (#321).TransactionBuilder (#321).Keypair.xdrMuxedAccount which creates a new xdr.MuxedAccount(#325).~FeeBumpTransaction which makes it easy to work with fee bump transactions (#328).TransactionBuilder.fromXDR which receives an xdr envelope and return a Transaction or FeeBumpTransaction (#328).Transaction to work with TransactionV1Envelope and TransactionV0Envelope (#317).Add backward compatibility support for CAP0018 (#317). CAP0018 provides issuers with a new level of authorization between unauthorized and fully authorized, called "authorized to maintain liabilities". The changes in this release allow you to use the new authorization level and provides backward compatible support for Protocol 12.
Before Protocol 13, the argument authorize in the AllowTrust operation was of type boolean where true was authorize and false deauthorize. Starting in Protocol 13, this value is now a number where 0 is deauthorize, 1 is authorize, and 2 is authorize to maintain liabilities.
The syntax for authorizing a trustline is still the same, but the authorize parameter is now a number.
Operation.allowTrust({
trustor: trustor.publicKey(),
assetCode: "COP",
authorize: 1,
});You can use still use a boolean; however, we recommend you update your code to pass a number instead. Finally, using the value 2 for authorize to maintain liabilities will only be valid if Stellar Core is running on Protocol 13; otherwise, you'll get an error.
~Update operations builder to support multiplexed accounts (#337).~
Transaction.toEnvelope() returns a protocol 13 xdr.TransactionEnvelope which is an xdr.Union (#317).
If you have code that looks like this - transaction.toEnvelope().tx - you have two options:value() like transaction.toEnvelope().value().tx.switch() and then call v0(), v1(), or feeBump().Transaction.fee changed from number to string. This brings support for Int64 values (#321).BASE_FEE changed from number to string (#321).fee passed to new TransactionBuilder({fee: ..}) changed from number to string (#321).The following fields, which were previously an xdr.AccountID are now a xdr.MuxedAccount (#325):
PaymentOp.destinationPathPaymentStrictReceiveOp.destinationPathPaymentStrictSendOp.destinationOperation.sourceAccountOperation.destination (for ACCOUNT_MERGE)Transaction.sourceAccountFeeBumpTransaction.feeSourceYou can get the string representation by calling StrKey.encodeMuxedAccount which will return a G.. or M.. account.
Remove the following deprecated functions (#331):
Operation.manageOfferOperation.createPassiveOfferOperation.pathPaymentKeypair.fromBase58SeedNetwork class (#331).vendor/base58.js (#331).Update operations builder to support multiplexed accounts (#337).
This allows you to specify an M account as the destination or source:
var destination = 'MAAAAAAAAAAAAAB7BQ2L7E5NBWMXDUCMZSIPOBKRDSBYVLMXGSSKF6YNPIB7Y77ITLVL6';
var amount = '1000.0000000';
var asset = new StellarBase.Asset(
'USDUSD',
'GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7'
);
var source =
'MAAAAAAAAAAAAAB7BQ2L7E5NBWMXDUCMZSIPOBKRDSBYVLMXGSSKF6YNPIB7Y77ITLVL6';
StellarBase.Operation.payment({
destination,
asset,
amount,
source
});To use multiplexed accounts you need an instance of Stellar running on Protocol 13 or higher
This version brings protocol 13 support with backwards compatibility support for protocol 12.
TransactionBuilder.buildFeeBumpTransaction which makes it easy to create FeeBumpTransaction (#321).TransactionBuilder (#321).Keypair.xdrMuxedAccount which creates a new xdr.MuxedAccount(#325).FeeBumpTransaction which makes it easy to work with fee bump transactions (#328).TransactionBuilder.fromXDR which receives an xdr envelope and return a Transaction or FeeBumpTransaction (#328).Transaction to work with TransactionV1Envelope and TransactionV0Envelope (#317).Transaction.toEnvelope() returns a protocol 13 xdr.TransactionEnvelope which is an xdr.Union (#317).
If you have code that looks like this transaction.toEnvelope().tx you have two options:value() like transaction.toEnvelope().value().tx.switch() and then call v0(), v1(), or feeBump().Transaction.fee changed from number to string. This brings support for Int64 values (#321).BASE_FEE changed from number to string (#321).fee passed to new TransactionBuilder({fee: ..}) changed from number to string (#321).The following fields, which were previously an xdr.AccountID are now a xdr.MuxedAccount (#325):
PaymentOp.destinationPathPaymentStrictReceiveOp.destinationPathPaymentStrictSendOp.destinationOperation.sourceAccountOperation.destination (for ACCOUNT_MERGE)Transaction.sourceAccountFeeBumpTransaction.feeSourceYou can get the string representation by calling StrKey.encodeMuxedAccount which will return a G.. or M.. account.
Remove the following deprecated functions (#331):
Operation.manageOfferOperation.createPassiveOfferOperation.pathPaymentKeypair.fromBase58SeedNetwork class (#331).vendor/base58.js (#331).setTimeout(0) and partially defined timebounds (#315).ManageData operation to allow setting value to null (#310)toXDR type to Transaction class (#296)new Transaction().
(284)Operation to show pathPaymentStrictSend and pathPaymentStrictReceive. (279)Update asset.toString() to return canonical representation for asset. (277).
Calling asset.toString() will return native for XLM or AssetCode:AssetIssuer for issued assets. See this PR for more information.
This release adds support for stellar-core protocol 12 release and CAP 24 ("Make PathPayment Symmetrical").
Operation.pathPaymentStrictSend: Sends a path payments, debiting from the source account exactly a specified amount of one asset, crediting at least a given amount of another asset. (#274).
The following operation will debit exactly 10 USD from the source account, crediting at least 9.2 EUR in the destination account 💸:
var sendAsset = new StellarBase.Asset(
"USD",
"GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7"
);
var sendAmount = "10";
var destination = "GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ";
var destAsset = new StellarBase.Asset(
"USD",
"GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7"
);
var destMin = "9.2";
var path = [
new StellarBase.Asset(
"USD",
"GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB"
),
new StellarBase.Asset(
"EUR",
"GDTNXRLOJD2YEBPKK7KCMR7J33AAG5VZXHAJTHIG736D6LVEFLLLKPDL"
),
];
let op = StellarBase.Operation.pathPaymentStrictSend({
sendAsset,
sendAmount,
destination,
destAsset,
destMin,
path,
});Operation.pathPaymentStrictReceive: This behaves the same as the former pathPayments operation. (#274).
The following operation will debit maximum 10 USD from the source account, crediting exactly 9.2 EUR in the destination account 💸:
var sendAsset = new StellarBase.Asset(
"USD",
"GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7"
);
var sendMax = "10";
var destination = "GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ";
var destAsset = new StellarBase.Asset(
"USD",
"GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7"
);
var destAmount = "9.2";
var path = [
new StellarBase.Asset(
"USD",
"GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB"
),
new StellarBase.Asset(
"EUR",
"GDTNXRLOJD2YEBPKK7KCMR7J33AAG5VZXHAJTHIG736D6LVEFLLLKPDL"
),
];
let op = StellarBase.Operation.pathPaymentStrictReceive({
sendAsset,
sendMax,
destination,
destAsset,
destAmount,
path,
});Operation.pathPayment is being deprecated in favor of Operation.pathPaymentStrictReceive. Both functions take the same arguments and behave the same. (#274).No changes. Fixes deploy script and includes changes from v2.0.0.
Deprecate global singleton for Network. The following classes and
methods take an optional network passphrase, and issue a warning if it
is not passed:
Keypair.masterKeypair.master(Networks.TESTNET);Transactionconst xenv = new xdr.TransactionEnvelope({ tx: xtx });
new Transaction(xenv, Networks.TESTNET);TransactionBuilder and method TransactionBuilder.setNetworkPassphraseconst transaction = new StellarSdk.TransactionBuilder(account, {
fee: StellarSdk.BASE_FEE,
networkPassphrase: Networks.TESTNET,
});See #207 and #112 for more information.
The Network class will be removed on the 2.0 release.
toString() to Asset (#172)sodium-native was making it into the browser bundle, which
is supposed to use tweetnacl.Operation.manageOffer and Operation.createPassiveOffer, and issue
a warning if they're called.Operation.manageOffer to Operation.manageSellOffer.Operation.createPassiveOffer to Operation.createPassiveSellOffer.Operation.manageBuyOffer.fee parameter to TransactionBuilder is now
required. Failing to provide a fee will throw an error.crypto library. This reduces the number of Node built-ins we have
to shim into the production bundle, and incidentally fixes a bug with
Angular 6.fee param is now deprecated
and will issue a warning. In a later release, it will throw an error. Please
update your transaction builders as soon as you can!toXDR function for transactions that lets you get the transaction as a
base64-encoded string (so you may enter it into the Stellar Laboratory XDR
viewer, for one)Date support for TransactionBuilder timeboundsTransaction that support pre-generated transactions:getKeypairSignature helps users sign pre-generated transaction XDRsaddSignature lets you add pre-generated signatures to a built transactionTransactionBuilder.setTimeout
method that sets timebounds.max_time on a transaction. Because of the
distributed nature of the Stellar network it is possible that the status of
your transaction will be determined after a long time if the network is highly
congested. If you want to be sure to receive the status of the transaction
within a given period you should set the TimeBounds with maxTime on the
transaction (this is what setTimeout does internally; if there's minTime
set but no maxTime it will be added). Call to
TransactionBuilder.setTimeout is required if Transaction does not have
max_time set. If you don't want to set timeout, use TimeoutInfinite. In
general you should set TimeoutInfinite only in smart contracts. Please check
TransactionBuilder.setTimeout
docs for more information.homeDomain.js-xdr to support unmarshaling non-utf8 strings.Operation.fromXDRObject() are of type Buffer now
(except SetOptions.home_domain and ManageData.name - both required to be
ASCII by stellar-core).xdr files to V10.js-xdr.src from .npmignore.bump_sequence operation.Keypair.constructor now requires type field to define public-key signature
system used in this instance (so Keypair can support other systems in a
future). It also checks if public key and secret key match if both are passed
(to prevent nasty bugs).Keypair.fromRawSeed has been renamed to Keypair.fromRawEd25519Seed to make
it clear that the seed must be Ed25519 seed.Memo class so it's easier to check it's
type and value (without dealing with low level xdr.Memo objects).Asset.toXdrObject to Asset.toXDRObject and
Operation.operationToObject to Operation.toXDRObject for consistency.browser prop to package.json.sha256Hash, preAuthTx.StrKey helper class with strkey encoding related methods.Keypair.isValidPublicKey (use StrKey),
Keypair.isValidSecretKey (use StrKey), Keypair.fromSeed, Keypair.seed,
Keypair.rawSeed.Network must be explicitly selected. Previously testnet was a default
network.Operation.setOptions() method signer param changed.Keypair.fromAccountId() renamed to Keypair.fromPublicKey().Keypair.accountId() renamed to Keypair.publicKey().End-of-Life node versions.ed25519 package is now optional dependency.Memo.text().Account.isValidAccountId to Keypair.isValidPublicKey. It's still
possible to use Account.isValidAccountId but it will be removed in the next
minor release (breaking change). (af10f2a)signer.address option in Operation.setOptions was changed to
signer.pubKey. It's still possible to use signer.address but it will be
removed in the next minor release (breaking change). (07f43fb)Operation.setOptions now accepts strings for clearFlags, setFlags,
masterWeight, lowThreshold, medThreshold, highThreshold,
signer.weight options. (665e018)CHANGELOG.md file.price params as {n: numerator, d: denominator}
object. Thanks @FredericHeem. (#73)sequence in Account constructor must be a string.
(4da5dfc)Account.isValidAddress (replaced by Account.isValidAccountId)Account.getSequenceNumber (replaced by Account.sequenceNumber)Keypair.address (replaced by Keypair.accountId)Network.usePublicNet (replaced by Network.usePublicNetwork)Network.useTestNet (replaced by Network.useTestNetwork)TransactionBuilder.addSigner (call Transaction.sign on build
Transaction object)