@stellar/stellar-base 14.0.4 → 14.1.0

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/types/index.d.ts CHANGED
@@ -1062,6 +1062,17 @@ export class Transaction<
1062
1062
  export const BASE_FEE = '100';
1063
1063
  export const TimeoutInfinite = 0;
1064
1064
 
1065
+ /**
1066
+ * Represents the fees associated with a Soroban transaction, including the number of instructions executed,
1067
+ * the number of bytes read and written to the ledger, and the total resource fee in stroops.
1068
+ */
1069
+ export interface SorobanFees {
1070
+ instructions: number;
1071
+ readBytes: number;
1072
+ writeBytes: number;
1073
+ resourceFee: bigint;
1074
+ }
1075
+
1065
1076
  export class TransactionBuilder {
1066
1077
  constructor(
1067
1078
  sourceAccount: Account,
@@ -1080,6 +1091,19 @@ export class TransactionBuilder {
1080
1091
  setMinAccountSequenceLedgerGap(gap: number): this;
1081
1092
  setExtraSigners(extraSigners: string[]): this;
1082
1093
  setSorobanData(sorobanData: string | xdr.SorobanTransactionData): this;
1094
+ /**
1095
+ * Creates and adds an invoke host function operation for transferring SAC tokens.
1096
+ * This method removes the need for simulation by handling the creation of the
1097
+ * appropriate authorization entries and ledger footprint for the transfer operation.
1098
+ *
1099
+ * @param destination - the address of the recipient of the SAC transfer (should be a valid Stellar address or contract ID)
1100
+ * @param asset - the SAC asset to be transferred
1101
+ * @param amount - the amount of tokens to be transferred in 7 decimals. IE 1 token with 7 decimals of precision would be represented as "1_0000000"
1102
+ * @param sorobanFees - optional Soroban fees for the transaction to override the default fees used
1103
+ *
1104
+ * @returns the TransactionBuilder instance with the SAC transfer operation added
1105
+ */
1106
+ addSacTransferOperation(destination: string, asset: Asset, amount: string | bigint, sorobanFees?: SorobanFees): this;
1083
1107
  build(): Transaction;
1084
1108
  setNetworkPassphrase(networkPassphrase: string): this;
1085
1109