Skip to content
Merged
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
2 changes: 2 additions & 0 deletions rpcs/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ paths:
$ref: './transaction/EXPERIMENTAL_tx_status.yaml#/paths/~1'
/EXPERIMENTAL_receipt:
$ref: './transaction/EXPERIMENTAL_receipt.yaml#/paths/~1'
/EXPERIMENTAL_receipt_to_tx:
$ref: './transaction/EXPERIMENTAL_receipt_to_tx.yaml#/paths/~1'

# Validator operations
/validators_current:
Expand Down
119 changes: 119 additions & 0 deletions rpcs/transaction/EXPERIMENTAL_receipt_to_tx.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
openapi: 3.1.0
info:
title: "NEAR Protocol RPC: Resolve receipt to transaction"
description: "Resolve a receipt ID to the transaction hash and signer that produced it. Requires a node with `save_receipt_to_tx` enabled; unindexed receipts return `UNKNOWN_RECEIPT`."
version: 1.0.0
servers:
- url: "https://rpc.mainnet.fastnear.com"
description: Mainnet
- url: "https://rpc.testnet.fastnear.com"
description: Testnet
paths:
/:
post:
operationId: EXPERIMENTAL_receipt_to_tx
summary: Resolve receipt to transaction
description: "Resolve a receipt ID to the transaction hash and signer that produced it. Requires a node with `save_receipt_to_tx` enabled; unindexed receipts return `UNKNOWN_RECEIPT`."
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [jsonrpc, id, method, params]
properties:
jsonrpc:
type: string
enum: ["2.0"]
id:
type: string
example: fastnear
method:
type: string
enum: [EXPERIMENTAL_receipt_to_tx]
params:
type: object
properties:
block_height:
type: [integer, "null"]
description: "Optional hint: block height near where the receipt was created, to bound the fallback scan."
format: uint64
minimum: 0
receipt_id:
type: string
description: Base58-encoded receipt ID to resolve to its originating transaction.
shard_id:
type: [integer, "null"]
description: "Optional hint: shard to scan at the hint height; omit to scan all tracked shards."
window:
type: [integer, "null"]
description: "Optional hint: ± block-height window scanned around the hint before walking ancestor blocks."
format: uint64
minimum: 0
required: [receipt_id]
examples:
mainnet:
summary: Resolve receipt to transaction (Mainnet)
value:
jsonrpc: "2.0"
id: fastnear
method: EXPERIMENTAL_receipt_to_tx
params:
receipt_id: FcFKrKQziMPCgYMFiLMZwecBtA7vqxdkatkhc1j3GYj8
testnet:
summary: Resolve receipt to transaction (Testnet)
value:
jsonrpc: "2.0"
id: fastnear
method: EXPERIMENTAL_receipt_to_tx
params:
block_height: null
receipt_id: ExampleReceiptId
shard_id: 0
window: null
responses:
200:
description: Successful response
content:
application/json:
schema:
$ref: "#/components/schemas/JsonRpcResponse"
security:
- ApiKeyAuth: []
components:
securitySchemes:
ApiKeyAuth:
type: apiKey
in: query
name: apiKey
schemas:
JsonRpcResponse:
type: object
required: [jsonrpc, id]
properties:
jsonrpc:
type: string
enum: ["2.0"]
id:
oneOf:
- type: string
- type: number
result:
type: object
properties:
sender_account_id:
type: string
description: NEAR account ID
transaction_hash:
type: string
description: Base58-encoded hash
required: [transaction_hash, sender_account_id]
error:
type: object
properties:
code:
type: integer
message:
type: string
data:
type: object
2 changes: 1 addition & 1 deletion scripts/audit-page-model-routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const EXPECTED_FAMILY_COUNTS = {
"rpcs/block": 3,
"rpcs/contract": 5,
"rpcs/protocol": 20,
"rpcs/transaction": 6,
"rpcs/transaction": 7,
"rpcs/validators": 3,
"apis/fastnear": 14,
"apis/kv-fastdata": 9,
Expand Down
22 changes: 22 additions & 0 deletions scripts/nearcore-operation-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,28 @@ const OPERATIONS = [
},
},
},
{
type: 'simple',
nearcorePath: '/EXPERIMENTAL_receipt_to_tx',
file: 'transaction/EXPERIMENTAL_receipt_to_tx.yaml',
category: 'transaction',
operationId: 'EXPERIMENTAL_receipt_to_tx',
summary: 'Resolve receipt to transaction',
description: "Resolve a receipt ID to the transaction hash and signer that produced it. Requires a node with `save_receipt_to_tx` enabled; unindexed receipts return `UNKNOWN_RECEIPT`.",
fieldDescriptions: {
request: {
receipt_id: 'Base58-encoded receipt ID to resolve to its originating transaction.',
block_height: 'Optional hint: block height near where the receipt was created, to bound the fallback scan.',
shard_id: 'Optional hint: shard to scan at the hint height; omit to scan all tracked shards.',
window: 'Optional hint: ± block-height window scanned around the hint before walking ancestor blocks.',
},
},
exampleParamsByNetwork: {
mainnet: {
receipt_id: 'FcFKrKQziMPCgYMFiLMZwecBtA7vqxdkatkhc1j3GYj8',
},
},
},
{
type: 'simple',
nearcorePath: '/EXPERIMENTAL_protocol_config',
Expand Down
30 changes: 28 additions & 2 deletions scripts/rpc-example-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,19 @@ const CURATED_RPC_EXAMPLE_PARAMS = {
},
};

const ALLOWED_RPC_PLACEHOLDERS = {};
const ALLOWED_RPC_PLACEHOLDERS = {
// No curated testnet receipt yet; mainnet uses a real receipt id. Allow the
// generated placeholder on testnet until a real, index-resolvable testnet
// example is curated.
EXPERIMENTAL_receipt_to_tx: {
testnet: {
receipt_id: {
value: 'ExampleReceiptId',
reason: 'No curated testnet receipt yet; mainnet uses a real receipt id.',
},
},
},
};

const MANUAL_RPC_EXAMPLE_OVERRIDES = {
EXPERIMENTAL_protocol_config: {
Expand Down Expand Up @@ -159,7 +171,21 @@ const MANUAL_RPC_EXAMPLE_OVERRIDES = {
},
};

const AUDIT_SKIPS = {};
const AUDIT_SKIPS = {
// receipt→tx resolution needs a save_receipt_to_tx-enabled node with the
// receipt still indexed; the public RPC returns UNKNOWN_RECEIPT otherwise, so
// the example is representative-only and excluded from the live audit.
EXPERIMENTAL_receipt_to_tx: {
mainnet: {
skip: true,
reason: 'Requires a save_receipt_to_tx-enabled node with the receipt indexed; returns UNKNOWN_RECEIPT otherwise.',
},
testnet: {
skip: true,
reason: 'Requires a save_receipt_to_tx-enabled node with the receipt indexed; returns UNKNOWN_RECEIPT otherwise.',
},
},
};

function cloneJson(value) {
if (value === undefined) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/structured-graph-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ const EXPECTED_FAMILY_OPERATION_COUNTS = {
"rpc-block": 3,
"rpc-contract": 5,
"rpc-protocol": 20,
"rpc-transaction": 6,
"rpc-transaction": 7,
"rpc-validators": 3,
};

Expand Down
Loading
Loading