Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add New fields (Currency, HexBinary, DateTime, DateTime64, TxHash, HookHash, LedgerEntryID) #12

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions samples/hook-schemas/evernode-reputation/hook_state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ export const EvernodeReputationHookStateDefinition: Definition['hook_states'] =
byte_length: 24,
},
{
type: 'VarString',
type: 'HexBinary',
name: 'Special',
pattern: 'FFFFFFFFFFFFFFFF',
binary: true,
byte_length: 8,
},
],
Expand Down
2 changes: 0 additions & 2 deletions samples/hook-schemas/evernode/common/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,6 @@ export const CONF_MOMENT_TRANSIT_INFO: State = {
{
type: 'VarString',
name: 'Key',

pattern: 'EVR',
byte_length: 3,
exclude: true,
Expand Down Expand Up @@ -480,7 +479,6 @@ export const CONF_MAX_EMIT_TRX_FEE: State = {
{
type: 'VarString',
name: 'Key',

pattern: 'EVR',
byte_length: 3,
exclude: true,
Expand Down
53 changes: 28 additions & 25 deletions samples/hook-schemas/evernode/common/repetitive-state-keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ export const STP_TOKEN_ID: State = {
exclude: true,
},
{
type: 'VarString',
type: 'HexBinary',
name: 'TokenID',
byte_length: 28,
binary: true,
},
],
// <host_address(20)><cpu_model_name(40)><cpu_count(2)><cpu_speed(2)><cpu_microsec(4)><ram_mb(4)><disk_mb(4)><email(40)><accumulated_reward_amount(8)>
Expand Down Expand Up @@ -110,10 +109,8 @@ export const STP_HOST_ADDR: State = {
// <last_heartbeat_index(8)><version(3)><registration_timestamp(8)><transfer_flag(1)><last_vote_candidate_idx(4)><last_vote_timestamp(8)><support_vote_sent(1)><host_reputation(1)><flags(1)><transfer_timestamp(8)><host_lease_amount(8,xfl)>
hookstate_data: [
{
type: 'VarString',
type: 'LedgerEntryID',
name: 'TokenID',
byte_length: 32,
binary: true,
},
{
type: 'VarString',
Expand Down Expand Up @@ -172,8 +169,9 @@ export const STP_HOST_ADDR: State = {
delimiter: '.',
},
{
type: 'UInt64',
type: 'DateTime64',
name: 'Registration Timestamp',
epoch: 'unix',
},
{
type: 'UInt8',
Expand All @@ -184,8 +182,9 @@ export const STP_HOST_ADDR: State = {
name: 'Last Vote Candidate Idx',
},
{
type: 'UInt64',
type: 'DateTime64',
name: 'Last Vote Timestamp',
epoch: 'unix',
},
{
type: 'UInt8',
Expand All @@ -200,8 +199,9 @@ export const STP_HOST_ADDR: State = {
name: 'Flags',
},
{
type: 'UInt64',
type: 'DateTime64',
name: 'Transfer Timestamp',
epoch: 'unix',
},
{
type: 'XFL',
Expand Down Expand Up @@ -239,10 +239,9 @@ export const STP_HOST_ADDR_081: State = {
// <last_heartbeat_index(8)><version(3)><registration_timestamp(8)><transfer_flag(1)><last_vote_candidate_idx(4)><last_vote_timestamp(8)><support_vote_sent(1)><host_reputation(1)><flags(1)><transfer_timestamp(8)>
hookstate_data: [
{
type: 'VarString',
type: 'LedgerEntryID',
name: 'TokenID',
byte_length: 32,
binary: true,
},
{
type: 'VarString',
Expand Down Expand Up @@ -301,8 +300,9 @@ export const STP_HOST_ADDR_081: State = {
delimiter: '.',
},
{
type: 'UInt64',
type: 'DateTime64',
name: 'Registration Timestamp',
epoch: 'unix',
},
{
type: 'UInt8',
Expand All @@ -313,8 +313,9 @@ export const STP_HOST_ADDR_081: State = {
name: 'Last Vote Candidate Idx',
},
{
type: 'UInt64',
type: 'DateTime64',
name: 'Last Vote Timestamp',
epoch: 'unix',
},
{
type: 'UInt8',
Expand All @@ -329,8 +330,9 @@ export const STP_HOST_ADDR_081: State = {
name: 'Flags',
},
{
type: 'UInt64',
type: 'DateTime64',
name: 'Transfer Timestamp',
epoch: 'unix',
},
],
}
Expand Down Expand Up @@ -364,10 +366,8 @@ export const STP_HOST_ADDR_080: State = {
// <last_heartbeat_index(8)><version(3)><registration_timestamp(8)><transfer_flag(1)><last_vote_candidate_idx(4)><last_vote_timestamp(8)><support_vote_sent(1)><host_reputation(1)><flags(1)>
hookstate_data: [
{
type: 'VarString',
type: 'LedgerEntryID',
name: 'TokenID',
byte_length: 32,
binary: true,
},
{
type: 'VarString',
Expand Down Expand Up @@ -426,8 +426,9 @@ export const STP_HOST_ADDR_080: State = {
delimiter: '.',
},
{
type: 'UInt64',
type: 'DateTime64',
name: 'Registration Timestamp',
epoch: 'unix',
},
{
type: 'UInt8',
Expand All @@ -438,8 +439,9 @@ export const STP_HOST_ADDR_080: State = {
name: 'Last Vote Candidate Idx',
},
{
type: 'UInt64',
type: 'DateTime64',
name: 'Last Vote Timestamp',
epoch: 'unix',
},
{
type: 'UInt8',
Expand Down Expand Up @@ -492,10 +494,8 @@ export const STP_TRANSFEREE_ADDR: State = {
name: 'Registration Ledger',
},
{
type: 'VarString',
type: 'LedgerEntryID',
name: 'TokenID',
byte_length: 32,
binary: true,
},
],
}
Expand Down Expand Up @@ -585,28 +585,31 @@ export const STP_CANDIDATE_ID: State = {
byte_length: 20,
},
{
type: 'UInt64',
type: 'DateTime64',
name: 'Created Timestamp',
epoch: 'unix',
},
{
type: 'UInt64',
type: 'XFL',
name: 'Proposal Fee',
},
{
type: 'UInt32',
name: 'Positive Vote Count',
},
{
type: 'UInt64',
type: 'DateTime64',
name: 'Last Vote Timestamp',
epoch: 'unix',
},
{
type: 'UInt8',
name: 'Status',
},
{
type: 'UInt64',
type: 'DateTime64',
name: 'Status Change Timestamp',
epoch: 'unix',
},
{
type: 'UInt8',
Expand Down
9 changes: 6 additions & 3 deletions samples/hook-schemas/evernode/common/singleton-keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,24 +257,27 @@ export const STK_GOVERNANCE_INFO: State = {
name: 'Voter Base Count',
},
{
type: 'UInt64',
type: 'DateTime64',
name: 'Voter Base Count Changed Timestamp',
epoch: 'unix',
},
{
type: 'UInt32',
name: 'Foundation Last Voted Candidate Idx',
},
{
type: 'UInt64',
type: 'DateTime64',
name: 'Foundation Last Voted Timestamp',
epoch: 'unix',
},
{
type: 'Hash256',
name: 'Elected Proposal Unique Id',
},
{
type: 'UInt64',
type: 'DateTime64',
name: 'Proposal Elected Timestamp',
epoch: 'unix',
},
{
type: 'UInt8',
Expand Down
5 changes: 1 addition & 4 deletions samples/hook-schemas/oracle/invoke_blob.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { currencyToHex } from '@transia/hooks-toolkit/dist/npm/src/libs/binary-models'
import { decodeAccountID } from '@transia/xrpl'
import sha512h from '@transia/xrpl/dist/npm/utils/hashes/sha512Half'
import type { Definition } from '../../../schema'

export const OracleInvokeDefinition: Definition['invoke_blobs'] = {
Expand All @@ -17,7 +14,7 @@ export const OracleInvokeDefinition: Definition['invoke_blobs'] = {
name: 'issuer',
},
{
type: 'VarString',
type: 'Currency',
byte_length: 20,
name: 'currency',
},
Expand Down
15 changes: 4 additions & 11 deletions samples/hook-schemas/xahau-governance/hook_state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export const GovernanceHookStateDefinition: Definition['hook_states'] = {
],
hookstate_data: [
{
type: 'Hash256',
type: 'HookHash',
name: 'HookHash',
},
],
Expand Down Expand Up @@ -247,9 +247,8 @@ export const GovernanceHookStateDefinition: Definition['hook_states'] = {
name: 'Layer',
},
{
type: 'VarString',
type: 'HexBinary',
byte_length: 28,
binary: true,
name: 'HookHash',
},
],
Expand All @@ -274,11 +273,8 @@ export const GovernanceHookStateDefinition: Definition['hook_states'] = {
name: 'Layer',
},
{
type: 'VarString',
name: 'padding',
type: 'Null',
byte_length: 20,
binary: true,
exclude: true,
},
{
type: 'XFL',
Expand Down Expand Up @@ -306,11 +302,8 @@ export const GovernanceHookStateDefinition: Definition['hook_states'] = {
name: 'Layer',
},
{
type: 'VarString',
name: 'padding',
type: 'Null',
byte_length: 20,
binary: true,
exclude: true,
},
{
type: 'XFL',
Expand Down
Loading