2023-02-03 10:29:27 +01:00
|
|
|
-- Keystore queries
|
|
|
|
|
|
|
|
--name: write-key-pair
|
|
|
|
-- Save hex encoded private key
|
|
|
|
-- $1: public_key
|
|
|
|
-- $2: private_key
|
|
|
|
INSERT INTO keystore(public_key, private_key) VALUES($1, $2) RETURNING id
|
|
|
|
|
|
|
|
--name: load-key-pair
|
|
|
|
-- Load saved key pair
|
|
|
|
-- $1: public_key
|
2023-02-12 10:50:43 +01:00
|
|
|
SELECT private_key FROM keystore WHERE public_key=$1
|
2023-02-03 10:29:27 +01:00
|
|
|
|
|
|
|
-- OTX queries
|
2023-02-09 08:42:15 +01:00
|
|
|
|
|
|
|
--name: create-otx
|
|
|
|
-- Create a new locally originating tx
|
2023-02-12 10:50:43 +01:00
|
|
|
-- $1: tracking_id
|
|
|
|
-- $2: type
|
|
|
|
-- $3: raw_tx
|
|
|
|
-- $4: tx_hash
|
|
|
|
-- $5: from
|
|
|
|
-- $6: data
|
|
|
|
-- $7: gas_price
|
|
|
|
-- $8: nonce
|
2023-02-09 08:42:15 +01:00
|
|
|
INSERT INTO otx(
|
2023-02-12 10:50:43 +01:00
|
|
|
tracking_id,
|
|
|
|
"type",
|
2023-02-09 08:42:15 +01:00
|
|
|
raw_tx,
|
|
|
|
tx_hash,
|
2023-02-12 10:50:43 +01:00
|
|
|
"from",
|
|
|
|
"data",
|
2023-02-09 08:42:15 +01:00
|
|
|
gas_price,
|
2023-02-12 10:50:43 +01:00
|
|
|
nonce
|
|
|
|
) VALUES($1, $2, $3, $4, $5, $6, $7, $8) RETURNING id
|
2023-02-09 08:42:15 +01:00
|
|
|
|
|
|
|
|
|
|
|
-- Dispatch status queries
|
|
|
|
|
|
|
|
--name: create-dispatch-status
|
|
|
|
-- Create a new dispatch status
|
|
|
|
-- $1: otx_id
|
|
|
|
-- $2: status
|
2023-02-12 10:50:43 +01:00
|
|
|
INSERT INTO dispatch(
|
2023-02-09 08:42:15 +01:00
|
|
|
otx_id,
|
2023-02-12 10:50:43 +01:00
|
|
|
"status"
|
|
|
|
) VALUES($1, $2) RETURNING id
|