@stellar/stellar-base 10.0.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/CHANGELOG.md +1262 -0
- package/LICENSE +202 -0
- package/README.md +198 -0
- package/dist/stellar-base.js +30777 -0
- package/dist/stellar-base.min.js +2 -0
- package/lib/account.js +80 -0
- package/lib/address.js +169 -0
- package/lib/asset.js +323 -0
- package/lib/auth.js +253 -0
- package/lib/claimant.js +193 -0
- package/lib/contract.js +113 -0
- package/lib/events.js +42 -0
- package/lib/fee_bump_transaction.js +134 -0
- package/lib/generated/curr_generated.js +8315 -0
- package/lib/generated/next_generated.js +8315 -0
- package/lib/get_liquidity_pool_id.js +57 -0
- package/lib/hashing.js +12 -0
- package/lib/index.js +385 -0
- package/lib/invocation.js +195 -0
- package/lib/keypair.js +308 -0
- package/lib/liquidity_pool_asset.js +126 -0
- package/lib/liquidity_pool_id.js +101 -0
- package/lib/memo.js +270 -0
- package/lib/muxed_account.js +159 -0
- package/lib/network.js +22 -0
- package/lib/numbers/index.js +85 -0
- package/lib/numbers/int128.js +50 -0
- package/lib/numbers/int256.js +50 -0
- package/lib/numbers/sc_int.js +134 -0
- package/lib/numbers/uint128.js +50 -0
- package/lib/numbers/uint256.js +50 -0
- package/lib/numbers/xdr_large_int.js +267 -0
- package/lib/operation.js +715 -0
- package/lib/operations/account_merge.js +32 -0
- package/lib/operations/allow_trust.js +57 -0
- package/lib/operations/begin_sponsoring_future_reserves.js +38 -0
- package/lib/operations/bump_sequence.js +37 -0
- package/lib/operations/change_trust.js +52 -0
- package/lib/operations/claim_claimable_balance.js +40 -0
- package/lib/operations/clawback.js +46 -0
- package/lib/operations/clawback_claimable_balance.js +39 -0
- package/lib/operations/create_account.js +37 -0
- package/lib/operations/create_claimable_balance.js +65 -0
- package/lib/operations/create_passive_sell_offer.js +44 -0
- package/lib/operations/end_sponsoring_future_reserves.js +27 -0
- package/lib/operations/extend_footprint_ttl.js +45 -0
- package/lib/operations/index.js +254 -0
- package/lib/operations/inflation.js +23 -0
- package/lib/operations/invoke_host_function.js +219 -0
- package/lib/operations/liquidity_pool_deposit.js +64 -0
- package/lib/operations/liquidity_pool_withdraw.js +50 -0
- package/lib/operations/manage_buy_offer.js +50 -0
- package/lib/operations/manage_data.js +41 -0
- package/lib/operations/manage_sell_offer.js +50 -0
- package/lib/operations/path_payment_strict_receive.js +68 -0
- package/lib/operations/path_payment_strict_send.js +68 -0
- package/lib/operations/payment.js +47 -0
- package/lib/operations/restore_footprint.js +38 -0
- package/lib/operations/revoke_sponsorship.js +301 -0
- package/lib/operations/set_options.js +135 -0
- package/lib/operations/set_trustline_flags.js +84 -0
- package/lib/scval.js +369 -0
- package/lib/signerkey.js +103 -0
- package/lib/signing.js +96 -0
- package/lib/soroban.js +96 -0
- package/lib/sorobandata_builder.js +218 -0
- package/lib/strkey.js +400 -0
- package/lib/transaction.js +369 -0
- package/lib/transaction_base.js +248 -0
- package/lib/transaction_builder.js +753 -0
- package/lib/util/checksum.js +20 -0
- package/lib/util/continued_fraction.js +58 -0
- package/lib/util/decode_encode_muxed_account.js +116 -0
- package/lib/util/util.js +14 -0
- package/lib/xdr.js +9 -0
- package/package.json +133 -0
- package/types/curr.d.ts +14078 -0
- package/types/index.d.ts +1270 -0
- package/types/next.d.ts +14078 -0
- package/types/xdr.d.ts +1 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.FeeBumpTransaction = void 0;
|
|
8
|
+
var _xdr = _interopRequireDefault(require("./xdr"));
|
|
9
|
+
var _hashing = require("./hashing");
|
|
10
|
+
var _transaction = require("./transaction");
|
|
11
|
+
var _transaction_base = require("./transaction_base");
|
|
12
|
+
var _decode_encode_muxed_account = require("./util/decode_encode_muxed_account");
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
14
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
15
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
16
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
17
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
18
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
19
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
20
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
21
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
22
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
23
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
24
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
25
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
26
|
+
/**
|
|
27
|
+
* Use {@link TransactionBuilder.buildFeeBumpTransaction} to build a
|
|
28
|
+
* FeeBumpTransaction object. If you have an object or base64-encoded string of
|
|
29
|
+
* the transaction envelope XDR use {@link TransactionBuilder.fromXDR}.
|
|
30
|
+
*
|
|
31
|
+
* Once a {@link FeeBumpTransaction} has been created, its attributes and operations
|
|
32
|
+
* should not be changed. You should only add signatures (using {@link FeeBumpTransaction#sign}) before
|
|
33
|
+
* submitting to the network or forwarding on to additional signers.
|
|
34
|
+
*
|
|
35
|
+
* @param {string|xdr.TransactionEnvelope} envelope - transaction envelope
|
|
36
|
+
* object or base64 encoded string.
|
|
37
|
+
* @param {string} networkPassphrase - passphrase of the target Stellar network
|
|
38
|
+
* (e.g. "Public Global Stellar Network ; September 2015").
|
|
39
|
+
*
|
|
40
|
+
* @extends TransactionBase
|
|
41
|
+
*/
|
|
42
|
+
var FeeBumpTransaction = exports.FeeBumpTransaction = /*#__PURE__*/function (_TransactionBase) {
|
|
43
|
+
_inherits(FeeBumpTransaction, _TransactionBase);
|
|
44
|
+
var _super = _createSuper(FeeBumpTransaction);
|
|
45
|
+
function FeeBumpTransaction(envelope, networkPassphrase) {
|
|
46
|
+
var _this;
|
|
47
|
+
_classCallCheck(this, FeeBumpTransaction);
|
|
48
|
+
if (typeof envelope === 'string') {
|
|
49
|
+
var buffer = Buffer.from(envelope, 'base64');
|
|
50
|
+
envelope = _xdr["default"].TransactionEnvelope.fromXDR(buffer);
|
|
51
|
+
}
|
|
52
|
+
var envelopeType = envelope["switch"]();
|
|
53
|
+
if (envelopeType !== _xdr["default"].EnvelopeType.envelopeTypeTxFeeBump()) {
|
|
54
|
+
throw new Error("Invalid TransactionEnvelope: expected an envelopeTypeTxFeeBump but received an ".concat(envelopeType.name, "."));
|
|
55
|
+
}
|
|
56
|
+
var txEnvelope = envelope.value();
|
|
57
|
+
var tx = txEnvelope.tx();
|
|
58
|
+
var fee = tx.fee().toString();
|
|
59
|
+
// clone signatures
|
|
60
|
+
var signatures = (txEnvelope.signatures() || []).slice();
|
|
61
|
+
_this = _super.call(this, tx, signatures, fee, networkPassphrase);
|
|
62
|
+
var innerTxEnvelope = _xdr["default"].TransactionEnvelope.envelopeTypeTx(tx.innerTx().v1());
|
|
63
|
+
_this._feeSource = (0, _decode_encode_muxed_account.encodeMuxedAccountToAddress)(_this.tx.feeSource());
|
|
64
|
+
_this._innerTransaction = new _transaction.Transaction(innerTxEnvelope, networkPassphrase);
|
|
65
|
+
return _this;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @type {Transaction}
|
|
70
|
+
* @readonly
|
|
71
|
+
*/
|
|
72
|
+
_createClass(FeeBumpTransaction, [{
|
|
73
|
+
key: "innerTransaction",
|
|
74
|
+
get: function get() {
|
|
75
|
+
return this._innerTransaction;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @type {Operation[]}
|
|
80
|
+
* @readonly
|
|
81
|
+
*/
|
|
82
|
+
}, {
|
|
83
|
+
key: "operations",
|
|
84
|
+
get: function get() {
|
|
85
|
+
return this._innerTransaction.operations;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* @type {string}
|
|
90
|
+
* @readonly
|
|
91
|
+
*/
|
|
92
|
+
}, {
|
|
93
|
+
key: "feeSource",
|
|
94
|
+
get: function get() {
|
|
95
|
+
return this._feeSource;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Returns the "signature base" of this transaction, which is the value
|
|
100
|
+
* that, when hashed, should be signed to create a signature that
|
|
101
|
+
* validators on the Stellar Network will accept.
|
|
102
|
+
*
|
|
103
|
+
* It is composed of a 4 prefix bytes followed by the xdr-encoded form
|
|
104
|
+
* of this transaction.
|
|
105
|
+
* @returns {Buffer}
|
|
106
|
+
*/
|
|
107
|
+
}, {
|
|
108
|
+
key: "signatureBase",
|
|
109
|
+
value: function signatureBase() {
|
|
110
|
+
var taggedTransaction = new _xdr["default"].TransactionSignaturePayloadTaggedTransaction.envelopeTypeTxFeeBump(this.tx);
|
|
111
|
+
var txSignature = new _xdr["default"].TransactionSignaturePayload({
|
|
112
|
+
networkId: _xdr["default"].Hash.fromXDR((0, _hashing.hash)(this.networkPassphrase)),
|
|
113
|
+
taggedTransaction: taggedTransaction
|
|
114
|
+
});
|
|
115
|
+
return txSignature.toXDR();
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* To envelope returns a xdr.TransactionEnvelope which can be submitted to the network.
|
|
120
|
+
* @returns {xdr.TransactionEnvelope}
|
|
121
|
+
*/
|
|
122
|
+
}, {
|
|
123
|
+
key: "toEnvelope",
|
|
124
|
+
value: function toEnvelope() {
|
|
125
|
+
var envelope = new _xdr["default"].FeeBumpTransactionEnvelope({
|
|
126
|
+
tx: _xdr["default"].FeeBumpTransaction.fromXDR(this.tx.toXDR()),
|
|
127
|
+
// make a copy of the tx
|
|
128
|
+
signatures: this.signatures.slice() // make a copy of the signatures
|
|
129
|
+
});
|
|
130
|
+
return new _xdr["default"].TransactionEnvelope.envelopeTypeTxFeeBump(envelope);
|
|
131
|
+
}
|
|
132
|
+
}]);
|
|
133
|
+
return FeeBumpTransaction;
|
|
134
|
+
}(_transaction_base.TransactionBase);
|