mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
update hook api
This commit is contained in:
@@ -9,6 +9,8 @@ cat $RIPPLED_SRC_DIR/ripple/protocol/impl/SField.cpp | grep -E '^CONSTRUCT_' |
|
||||
sed 's/UINT64/3/g' |
|
||||
sed 's/HASH128/4/g' |
|
||||
sed 's/HASH256/5/g' |
|
||||
sed 's/UINT128/4/g' |
|
||||
sed 's/UINT256/5/g' |
|
||||
sed 's/AMOUNT/6/g' |
|
||||
sed 's/VL/7/g' |
|
||||
sed 's/ACCOUNT/8/g' |
|
||||
@@ -16,6 +18,7 @@ cat $RIPPLED_SRC_DIR/ripple/protocol/impl/SField.cpp | grep -E '^CONSTRUCT_' |
|
||||
sed 's/ARRAY/15/g' |
|
||||
sed 's/UINT8/16/g' |
|
||||
sed 's/HASH160/17/g' |
|
||||
sed 's/UINT160/17/g' |
|
||||
sed 's/PATHSET/18/g' |
|
||||
sed 's/VECTOR256/19/g' |
|
||||
sed 's/UINT96/20/g' |
|
||||
@@ -25,3 +28,4 @@ cat $RIPPLED_SRC_DIR/ripple/protocol/impl/SField.cpp | grep -E '^CONSTRUCT_' |
|
||||
grep -Eo '"([^"]+)", *([0-9]+), *([0-9]+)' |
|
||||
sed 's/"//g' | sed 's/ *//g' | sed 's/,/ /g' |
|
||||
awk '{print ("#define sf"$1" (("$2"U << 16U) + "$3"U)")}'
|
||||
|
||||
|
||||
@@ -147,11 +147,13 @@ extern int64_t etxn_burden (void );
|
||||
extern int64_t etxn_details (uint32_t write_ptr, uint32_t write_len);
|
||||
|
||||
/**
|
||||
* Compute the minimum fee required to be paid by a hypothetically emitted transaction based on its size in bytes.
|
||||
* @param The size of the emitted transaction in bytes
|
||||
* Compute the minimum fee required to be paid by a hypothetically emitted transaction.
|
||||
* Note: provide an sfFee field in your serialized transaction with a 0 value when passing to this function.
|
||||
* @param read_ptr A pointer to the buffer containing the serialized transaction whose fee is to be computed
|
||||
* @param read_len The length of the serialized transaction.
|
||||
* @return The minimum fee in drops this transaction should pay to succeed
|
||||
*/
|
||||
extern int64_t etxn_fee_base (uint32_t tx_byte_count);
|
||||
extern int64_t etxn_fee_base (uint32_t read_ptr, uint32_t read_len);
|
||||
|
||||
/**
|
||||
* Inform xrpld that you will be emitting at most @count@ transactions during the course of this hook execution.
|
||||
@@ -183,6 +185,18 @@ extern int64_t emit (uint32_t write_ptr, uint32_t write_len, uint
|
||||
*/
|
||||
extern int64_t hook_account (uint32_t write_ptr, uint32_t write_len);
|
||||
|
||||
/**
|
||||
* If this is a strongly executed hook then signal to xrpld that it wishes to be executed
|
||||
* again as a weak hook after the originating transaction has been applied to the ledger.
|
||||
*/
|
||||
extern int64_t hook_again (void);
|
||||
|
||||
/**
|
||||
* If this is a weakly executed hook then request the metadata for the originating transaction
|
||||
* be placed into the slot indicated
|
||||
*/
|
||||
extern int64_t meta_slot (uint32_t slot_no);
|
||||
|
||||
/**
|
||||
* Retrieve the hash of the currently executing hook.
|
||||
* @param write_ptr A buffer of at least 32 bytes to write into.
|
||||
@@ -201,8 +215,17 @@ extern int64_t fee_base (void);
|
||||
*/
|
||||
extern int64_t ledger_seq (void);
|
||||
|
||||
/**
|
||||
* Retrieve the ledger hash of the last closed ledger and write it into the buffer provided
|
||||
*/
|
||||
extern int64_t ledger_last_hash (uint32_t write_ptr, uint32_t write_len);
|
||||
|
||||
/**
|
||||
* Retrieve the XRPL timestamp of the last closed ledger and return it as an integer.
|
||||
* Tip: Add 946681200 to the result to turn it into a unix timestamp.
|
||||
*/
|
||||
extern int64_t ledger_last_time (void);
|
||||
|
||||
/**
|
||||
* Retrieve a nonce for use in an emitted transaction (or another task). Can be called repeatedly for multiple nonces.
|
||||
* @param write_ptr A buffer of at least 32 bytes to write into.
|
||||
@@ -212,6 +235,15 @@ extern int64_t ledger_last_hash (uint32_t write_ptr, uint32_t write_len);
|
||||
extern int64_t etxn_nonce (uint32_t write_ptr, uint32_t write_len);
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve a random nonce for use in anything. Can be called repeatedly for multiple nonces.
|
||||
* @param write_ptr A buffer of at least 32 bytes to write into.
|
||||
* @param write_len The length of that buffer
|
||||
* @return The number of bytes written into the buffer of a negative integer if an error occured.
|
||||
*/
|
||||
extern int64_t ledger_nonce (uint32_t write_ptr, uint32_t write_len);
|
||||
|
||||
|
||||
/**
|
||||
* Slot functions have not been implemented yet and the api for them is subject to change
|
||||
*/
|
||||
@@ -355,6 +387,8 @@ extern int64_t float_mantissa_set (int64_t float1, int64_t mantissa );
|
||||
extern int64_t float_sign (int64_t float1 );
|
||||
extern int64_t float_sign_set (int64_t float1, uint32_t negative );
|
||||
extern int64_t float_int (int64_t float1, uint32_t decimal_places, uint32_t abs);
|
||||
extern int64_t float_log (int64_t float1 );
|
||||
extern int64_t float_root (int64_t float1, uint32_t n );
|
||||
extern int64_t trace_float (uint32_t mread_ptr, uint32_t mread_len, int64_t float1);
|
||||
|
||||
|
||||
|
||||
@@ -55,9 +55,9 @@
|
||||
#define sfSettleDelay ((2U << 16U) + 39U)
|
||||
#define sfTicketCount ((2U << 16U) + 40U)
|
||||
#define sfTicketSequence ((2U << 16U) + 41U)
|
||||
#define sfTokenTaxon ((2U << 16U) + 42U)
|
||||
#define sfMintedTokens ((2U << 16U) + 43U)
|
||||
#define sfBurnedTokens ((2U << 16U) + 44U)
|
||||
#define sfNFTokenTaxon ((2U << 16U) + 42U)
|
||||
#define sfMintedNFTokens ((2U << 16U) + 43U)
|
||||
#define sfBurnedNFTokens ((2U << 16U) + 44U)
|
||||
#define sfHookStateCount ((2U << 16U) + 45U)
|
||||
#define sfEmitGeneration ((2U << 16U) + 46U)
|
||||
#define sfIndexNext ((3U << 16U) + 1U)
|
||||
@@ -71,17 +71,17 @@
|
||||
#define sfDestinationNode ((3U << 16U) + 9U)
|
||||
#define sfCookie ((3U << 16U) + 10U)
|
||||
#define sfServerVersion ((3U << 16U) + 11U)
|
||||
#define sfOfferNode ((3U << 16U) + 12U)
|
||||
#define sfNFTokenOfferNode ((3U << 16U) + 12U)
|
||||
#define sfEmitBurden ((3U << 16U) + 13U)
|
||||
#define sfHookOn ((3U << 16U) + 16U)
|
||||
#define sfHookInstructionCount ((3U << 16U) + 17U)
|
||||
#define sfHookReturnCode ((3U << 16U) + 18U)
|
||||
#define sfReferenceCount ((3U << 16U) + 19U)
|
||||
#define sfEmailHash ((4U << 16U) + 1U)
|
||||
#define sfTakerPaysCurrency ((17U << 16U) + 1U)
|
||||
#define sfTakerPaysIssuer ((17U << 16U) + 2U)
|
||||
#define sfTakerGetsCurrency ((17U << 16U) + 3U)
|
||||
#define sfTakerGetsIssuer ((17U << 16U) + 4U)
|
||||
#define sfTakerPaysCurrency ((10U << 16U) + 1U)
|
||||
#define sfTakerPaysIssuer ((10U << 16U) + 2U)
|
||||
#define sfTakerGetsCurrency ((10U << 16U) + 3U)
|
||||
#define sfTakerGetsIssuer ((10U << 16U) + 4U)
|
||||
#define sfLedgerHash ((5U << 16U) + 1U)
|
||||
#define sfParentHash ((5U << 16U) + 2U)
|
||||
#define sfTransactionHash ((5U << 16U) + 3U)
|
||||
@@ -91,7 +91,7 @@
|
||||
#define sfWalletLocator ((5U << 16U) + 7U)
|
||||
#define sfRootIndex ((5U << 16U) + 8U)
|
||||
#define sfAccountTxnID ((5U << 16U) + 9U)
|
||||
#define sfTokenID ((5U << 16U) + 10U)
|
||||
#define sfNFTokenID ((5U << 16U) + 10U)
|
||||
#define sfEmitParentTxnID ((5U << 16U) + 11U)
|
||||
#define sfEmitNonce ((5U << 16U) + 12U)
|
||||
#define sfEmitHookHash ((5U << 16U) + 13U)
|
||||
@@ -106,8 +106,8 @@
|
||||
#define sfValidatedHash ((5U << 16U) + 25U)
|
||||
#define sfPreviousPageMin ((5U << 16U) + 26U)
|
||||
#define sfNextPageMin ((5U << 16U) + 27U)
|
||||
#define sfBuyOffer ((5U << 16U) + 28U)
|
||||
#define sfSellOffer ((5U << 16U) + 29U)
|
||||
#define sfNFTokenBuyOffer ((5U << 16U) + 28U)
|
||||
#define sfNFTokenSellOffer ((5U << 16U) + 29U)
|
||||
#define sfHookStateKey ((5U << 16U) + 30U)
|
||||
#define sfHookHash ((5U << 16U) + 31U)
|
||||
#define sfHookNamespace ((5U << 16U) + 32U)
|
||||
@@ -125,7 +125,8 @@
|
||||
#define sfMinimumOffer ((6U << 16U) + 16U)
|
||||
#define sfRippleEscrow ((6U << 16U) + 17U)
|
||||
#define sfDeliveredAmount ((6U << 16U) + 18U)
|
||||
#define sfBrokerFee ((6U << 16U) + 19U)
|
||||
#define sfNFTokenBrokerFee ((6U << 16U) + 19U)
|
||||
#define sfHookCallbackFee ((6U << 16U) + 20U)
|
||||
#define sfPublicKey ((7U << 16U) + 1U)
|
||||
#define sfMessageKey ((7U << 16U) + 2U)
|
||||
#define sfSigningPubKey ((7U << 16U) + 3U)
|
||||
@@ -157,13 +158,14 @@
|
||||
#define sfAuthorize ((8U << 16U) + 5U)
|
||||
#define sfUnauthorize ((8U << 16U) + 6U)
|
||||
#define sfRegularKey ((8U << 16U) + 8U)
|
||||
#define sfMinter ((8U << 16U) + 9U)
|
||||
#define sfNFTokenMinter ((8U << 16U) + 9U)
|
||||
#define sfEmitCallback ((8U << 16U) + 10U)
|
||||
#define sfHookAccount ((8U << 16U) + 16U)
|
||||
#define sfIndexes ((19U << 16U) + 1U)
|
||||
#define sfHashes ((19U << 16U) + 2U)
|
||||
#define sfAmendments ((19U << 16U) + 3U)
|
||||
#define sfTokenOffers ((19U << 16U) + 4U)
|
||||
#define sfNFTokenOffers ((19U << 16U) + 4U)
|
||||
#define sfHookNamespaces ((19U << 16U) + 5U)
|
||||
#define sfPaths ((18U << 16U) + 1U)
|
||||
#define sfTransactionMetaData ((14U << 16U) + 2U)
|
||||
#define sfCreatedNode ((14U << 16U) + 3U)
|
||||
@@ -175,7 +177,7 @@
|
||||
#define sfTemplateEntry ((14U << 16U) + 9U)
|
||||
#define sfMemo ((14U << 16U) + 10U)
|
||||
#define sfSignerEntry ((14U << 16U) + 11U)
|
||||
#define sfNonFungibleToken ((14U << 16U) + 12U)
|
||||
#define sfNFToken ((14U << 16U) + 12U)
|
||||
#define sfEmitDetails ((14U << 16U) + 13U)
|
||||
#define sfHook ((14U << 16U) + 14U)
|
||||
#define sfSigner ((14U << 16U) + 16U)
|
||||
@@ -193,7 +195,7 @@
|
||||
#define sfSufficient ((15U << 16U) + 7U)
|
||||
#define sfAffectedNodes ((15U << 16U) + 8U)
|
||||
#define sfMemos ((15U << 16U) + 9U)
|
||||
#define sfNonFungibleTokens ((15U << 16U) + 10U)
|
||||
#define sfNFTokens ((15U << 16U) + 10U)
|
||||
#define sfHooks ((15U << 16U) + 11U)
|
||||
#define sfMajorities ((15U << 16U) + 16U)
|
||||
#define sfDisabledValidators ((15U << 16U) + 17U)
|
||||
|
||||
Reference in New Issue
Block a user