pyth-crosschain/target_chains/near/scripts/update.sh

23 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# This is an example payload for subitting a price update from Hermes to a NEAR contract.
UPDATE_ARGS=$(
cat <<-EOF
{
"data": "504e41550100000000a0010000000001008918ed9b917292532426a110f9227ae4b3ef5aeb5cda0909e63f8fbccd7e9db742b70049436800ef44a686199ebcf2a778dfcf0bed52363b6a5c4eb8463f5db901654a687d00000000001ae101faedac5851e32b9b23b5f9411a8c2bac4aae3ed4dd7b811dd1a72ea4aa71000000000217fb2e01415557560000000000067f895500002710b2b3fe19d295ea084ee534ab1c39162192ec230f01005500f9c0172ba10dfa4d19088d94f5bf61d3b54d5bd7483a322a982e1373ee8ea31b00000328f52de1c000000000280de7fffffffff800000000654a687c00000000654a687c00000328e5f95d600000000036a473160a71021fa245677cb9e85bc0c46f68cfeb28123895c77156a0f8fbba3212d3d7d4ffdf9ff57856daa44d7127cdfb2295480839569025b5ce5b362de78e85eb029fd12640dde384d0bccce55b09d0bfd3cfa5171d0d08b93403b2b6b97808e7ef8146e8bf96aa1792ee7bd4d305a8b2d59a54a240f6fee3079a6afbac996283ff6fac58d39263ae502c66a4c1a95c1ef7aa8a171bf11ec4480d8a9bae68dd3b67c7ef9f547826dbb8af0466290b3509d389064c8c97739cc9afcd1beb090e85e1326274725b281f0b39"
}
EOF
)
# Feed through jq to get compressed JSON to avoid CLI weirdness.
UPDATE_JSON=$(echo "$UPDATE_ARGS" | jq -c '.' -M)
# Submit.
near call \
--accountId "780e82bd52465f8a4f5ed8cf5a30666eb41208849956bf87a377da9d8174e2b7" \
780e82bd52465f8a4f5ed8cf5a30666eb41208849956bf87a377da9d8174e2b7 \
update_price_feed \
--gas 300000000000000 \
--deposit 1 \
--args "$UPDATE_JSON"