-
Notifications
You must be signed in to change notification settings - Fork 258
feat: full PayRef implementation #7154
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
Changes from all commits
47b75f3
8151471
5b0bcd5
fb05599
7fde31e
c53884e
f0f6ad7
8ca45da
781cfc2
2abcb87
8f37a8b
daeff64
3b321a0
695924e
48cfe25
88e33cb
dadc129
664fe42
fd288b5
f21bb15
bd73907
d76c51a
2ae1b2a
7c93b22
93687e8
46eb56e
644cf9b
770f0a6
9a11e5e
03ead4b
cb3e8b1
923b936
f9e70fc
e7632eb
de60252
705bbec
d3e25c2
9032d07
6fb38b5
2c07b8d
185e1eb
388a3ef
fea3168
90e04cf
17ce4f7
9cb6dc7
5cf8dbd
018b3fb
fb87320
abb7766
9d22cca
615bf65
15bfce4
dfe5645
5d641a6
1a88b8e
c260f74
a5bbff6
4861fa1
a40f097
cffa97c
4b86d1a
7084874
4522bf8
29b60bf
5d99909
490674f
2142828
f41d3d3
fd29c26
bf83b2b
13b7a91
61184f1
2cff8bf
06c848a
0167d7d
726feaa
f171cbb
ebedf8c
9236031
3882fae
3b455d4
ecad66c
304b98b
b8819d4
29829eb
6d64c87
a3ac3ac
d712dc3
05a2877
cc102db
193cf29
77590fe
b7e94d3
943f41e
95c8d57
e6e8545
ee99dcc
f34e4a0
83fe76a
5424fa4
0fa10fa
5ed30e7
fe06ecd
06e88b0
9b68e38
361c302
ff10b0b
1546614
7ee6726
d2e063f
1536c88
6d230c1
1b25d0e
dbc597d
b5c128d
58e572d
d47e5c6
e3ae913
fbb44ec
5f68a66
b011c0f
e6cb0d8
bdad927
0e98362
226a55d
05ecb8c
6565bd9
5c362ff
b6badb7
ac5e904
a4e8b81
ed50664
f5bc192
3dd0da3
6ba8e56
8950f4c
1c3ea56
0da1a45
06af2fe
5dd0022
b26b338
c308e38
0201312
3373a8d
36feb75
5e687df
447d3ee
8f0e470
7de87ed
a994e2b
2b9ae6f
e152e06
f2f7a2b
1106632
78f86e2
fa05b71
f14efb7
b6be593
969faa0
3d9c660
f206653
2b001fd
87706ee
88f92b3
edfbff7
b58753c
37957f0
0f7eba6
e83dd17
59a01cd
cfa9d88
98aa160
82ed25b
e09fca4
f28531a
3b0fc3b
58d98cc
add2d86
7d8a87a
e266c78
f4890ef
a27a163
a4edf2f
ba5bd8d
50bc979
a7807db
c281d7d
0ce902f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -434,6 +434,44 @@ service Wallet { | |
| // ``` | ||
| rpc GetBlockHeightTransactions (GetBlockHeightTransactionsRequest) returns (GetBlockHeightTransactionsResponse); | ||
|
|
||
| // Returns all PayRefs (payment references) for a specific transaction. | ||
| // | ||
| // The `GetTransactionPayRefs` call retrieves all PayRefs associated with the specified | ||
| // transaction ID. PayRefs are cryptographic references generated from output hashes | ||
| // that allow recipients to verify payments without revealing sensitive transaction details. | ||
| // | ||
| // ### Request Parameters: | ||
| // | ||
| // - `transaction_id` (required): | ||
| // - **Type**: `uint64` | ||
| // - **Description**: The transaction ID to retrieve PayRefs for. | ||
| // - **Restrictions**: | ||
| // - Must be a valid transaction ID that exists in the wallet. | ||
| // - If the transaction ID is invalid or not found, an error will be returned. | ||
| // | ||
| // ### Example JavaScript gRPC client usage: | ||
| // | ||
| // ```javascript | ||
| // const request = { | ||
| // transaction_id: 12345 | ||
| // }; | ||
| // const response = await client.getTransactionPayRefs(request); | ||
| // console.log("PayRefs:", response.payment_references.map(ref => Buffer.from(ref).toString('hex'))); | ||
| // ``` | ||
| // | ||
| // ### Sample JSON Response: | ||
| // | ||
| // ```json | ||
| // { | ||
| // "payment_references": [ | ||
| // "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", | ||
| // "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321" | ||
| // ] | ||
| // } | ||
| // ``` | ||
| rpc GetTransactionPayRefs (GetTransactionPayRefsRequest) returns (GetTransactionPayRefsResponse); | ||
|
|
||
|
|
||
| // Returns the wallet balance details. | ||
| // | ||
| // The `GetBalance` call retrieves the current balance status of the wallet, | ||
|
|
@@ -1050,6 +1088,52 @@ service Wallet { | |
|
|
||
| // Get all completed transactions including cancelled ones, sorted by timestamp and paginated | ||
| rpc GetAllCompletedTransactions(GetAllCompletedTransactionsRequest) returns (GetAllCompletedTransactionsResponse); | ||
|
|
||
| // Gets transaction information by payment reference (PayRef) | ||
| // | ||
| // The `GetPaymentByReference` call retrieves transaction information using a 32-byte payment reference hash. | ||
| // PayRefs are generated as Blake2b_256(block_hash || output_hash) and provide a stable way to look up | ||
| // transactions even after outputs are spent. | ||
| // | ||
| // ### Request Parameters: | ||
| // | ||
| // - `payment_reference` (required): | ||
| // - **Type**: `bytes` (32 bytes) | ||
| // - **Description**: The payment reference hash to look up | ||
| // - **Restrictions**: Must be exactly 32 bytes representing a valid PayRef | ||
| // | ||
| // ### Example JavaScript gRPC client usage: | ||
| // | ||
| // ```javascript | ||
| // const payref = Buffer.from('a1b2c3d4e5f6789012345678901234567890123456789012345678901234567890', 'hex'); | ||
| // const request = { payment_reference: payref }; | ||
| // client.getPaymentByReference(request, (err, response) => { | ||
| // if (err) console.error(err); | ||
| // else console.log('Transaction found:', response.transaction); | ||
| // }); | ||
| // ``` | ||
| // | ||
| // ### Sample JSON Response: | ||
| // | ||
| // ```json | ||
| // { | ||
| // "transaction": { | ||
| // "tx_id": 12345, | ||
| // "source_address": "0x1234abcd...", | ||
| // "dest_address": "0x5678efgh...", | ||
| // "status": "TRANSACTION_STATUS_MINED_CONFIRMED", | ||
| // "direction": "TRANSACTION_DIRECTION_INBOUND", | ||
| // "amount": 1000000, | ||
| // "fee": 20, | ||
| // "is_cancelled": false, | ||
| // "excess_sig": "0xabcdef...", | ||
| // "timestamp": 1681234567, | ||
| // "payment_id": "0xdeadbeef...", | ||
| // "mined_in_block_height": 150000 | ||
| // } | ||
| // } | ||
| // ``` | ||
| rpc GetPaymentByReference(GetPaymentByReferenceRequest) returns (GetPaymentByReferenceResponse); | ||
SWvheerden marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
|
|
||
|
|
@@ -1197,6 +1281,9 @@ message TransactionInfo { | |
| bytes user_payment_id = 14; | ||
| repeated bytes input_commitments = 15; | ||
| repeated bytes output_commitments = 16; | ||
| repeated bytes payment_references_sent = 17; | ||
| repeated bytes payment_references_received = 18; | ||
| repeated bytes payment_references_change = 19; | ||
| } | ||
|
Comment on lines
+1284
to
1287
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Document new PayRef fields in TransactionInfo 🤖 Prompt for AI Agents |
||
|
|
||
| enum TransactionDirection { | ||
|
|
@@ -1252,6 +1339,7 @@ message GetCompletedTransactionsResponse { | |
| TransactionInfo transaction = 1; | ||
| } | ||
|
|
||
|
|
||
| // Request message for GetBalance RPC. | ||
| message GetBalanceRequest { | ||
| // Optional: A user-defined payment ID to filter balance data. | ||
|
|
@@ -1443,3 +1531,52 @@ message GetBlockHeightTransactionsResponse { | |
| // List of transactions mined at the specified block height | ||
| repeated TransactionInfo transactions = 1; | ||
| } | ||
|
|
||
| // PayRef (Payment Reference) related messages and enums | ||
|
|
||
| // Request message for GetTransactionPayRefs RPC. | ||
| message GetTransactionPayRefsRequest { | ||
| // The transaction ID to retrieve PayRefs for. | ||
| uint64 transaction_id = 1; | ||
| } | ||
|
|
||
| // Response message for GetTransactionPayRefs RPC. | ||
| message GetTransactionPayRefsResponse { | ||
| // List of PayRefs (32-byte payment references) for the transaction. | ||
| repeated bytes payment_references = 1; | ||
| } | ||
|
|
||
|
|
||
| // Response message for GetTransactionsWithPayRefs RPC. | ||
| message GetTransactionsWithPayRefsResponse { | ||
| // The transaction information. | ||
| TransactionInfo transaction = 1; | ||
| // List of PayRefs associated with this transaction. | ||
| repeated bytes payment_references = 2; | ||
| // Number of unique recipients for this transaction. | ||
| uint64 recipient_count = 3; | ||
| } | ||
|
|
||
|
Comment on lines
+1551
to
+1559
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add missing GetTransactionsWithPayRefs RPC 🤖 Prompt for AI Agents |
||
| // Request message for getting payment details by payment reference | ||
| message GetPaymentByReferenceRequest { | ||
| // The 32-byte payment reference hash to look up | ||
| bytes payment_reference = 1; | ||
| } | ||
|
|
||
| // Response message containing transaction information for a payment reference | ||
| message GetPaymentByReferenceResponse { | ||
| // The transaction information if PayRef is found (optional). | ||
| // Returns full transaction details | ||
| TransactionInfo transaction = 1; | ||
| } | ||
|
|
||
|
|
||
| // Enum for payment direction | ||
| enum PaymentDirection { | ||
| // Unknown or unspecified direction | ||
| PAYMENT_DIRECTION_UNKNOWN = 0; | ||
| // Payment received by this wallet | ||
| PAYMENT_DIRECTION_INBOUND = 1; | ||
| // Payment sent from this wallet | ||
| PAYMENT_DIRECTION_OUTBOUND = 2; | ||
| } | ||
SWvheerden marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Uh oh!
There was an error while loading. Please reload this page.