feat(quote): bind QuoteDetails / JobQuoteDetails to requester for tnt-core v0.13.0#16
Open
drewstone wants to merge 4 commits into
Open
feat(quote): bind QuoteDetails / JobQuoteDetails to requester for tnt-core v0.13.0#16drewstone wants to merge 4 commits into
drewstone wants to merge 4 commits into
Conversation
…13.0
Prepend `{ name: 'requester', type: 'address' }` as the first component of the
`details` tuple in createServiceFromQuotes. tnt-core v0.13.0 enforces
`requester == msg.sender` and rejects `address(0)` (no wildcard quotes).
Refs tnt-core#124, tnt-core#125
…0.13.0 - Add `requester: Address` to `OperatorQuote.details`. - Add `requester: Address` as a required parameter on `useQuotes` (no optional/undefined — tnt-core v0.13.0 contracts reject `address(0)`). - Forward `requester` to the operator JSON `/pricing/quote` body and populate it on the decoded payload (preferring the operator-signed echo, falling back to the hook input). - Defensive runtime guard at hook entry when `enabled=true`. - JSDoc explains the v0.13.0 contract behavior. Refs tnt-core#124, tnt-core#125
- Add `requester: Address` to `JobQuote` (signed into JobQuoteDetails by operators; tnt-core v0.13.0 enforces `requester == msg.sender`). - Add `requester: Address` as a required parameter on both `useJobPrice` and `useJobPrices`, with a shared `assertRequester` defensive guard that fires when `enabled=true`. - Forward `requester` to the operator JSON `/pricing/job-quote` body and populate it on the decoded payload (operator echo first, fallback to hook input). - Update the in-package `JobExecutionDialog` consumer to source `requester` from `useAccount().address` and gate `enabled` on a connected wallet. Refs tnt-core#124, tnt-core#125
Minor bump because consumers now must pass a non-zero `requester` to `useQuotes`, `useJobPrice`, and `useJobPrices`, and the `createServiceFromQuotes` ABI tuple shape gained a leading `requester` field. Pre-1.0 minor signals a breaking type change to consumers per package convention.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tnt-core v0.13.0 adds
address requesteras the first field of the typed-datastructs
Types.QuoteDetailsandTypes.JobQuoteDetails. The contract enforcesrequester == msg.senderand rejectsaddress(0)(no wildcard quotes). This PRthreads that field through the package's ABI and RFQ hooks.
This is a BREAKING type change for consumers. Downstream dapps using
useQuotes/useJobPrice/useJobPricesmust passuseAccount().addressas the new required
requesterargument. ThecreateServiceFromQuotesABItuple shape also changed, so old encoded payloads will not match v0.13.0
contract layouts.
Refs: tangle-network/tnt-core#124, tangle-network/tnt-core#125
Changes
src/contracts/abi.ts— prepend{ name: 'requester', type: 'address' }tothe
detailstuple insidecreateServiceFromQuotes.src/hooks/useQuotes.ts—OperatorQuote.details.requester: Address,required
requesterparameter onuseQuotes, JSON/pricing/quoterequest/response decoder threads it through, JSDoc + entry guard.
src/hooks/useJobPrice.ts—JobQuote.requester: Address, requiredrequesterparameter onuseJobPriceanduseJobPrices, decodersupdated, JSDoc + shared
assertRequesterguard.src/components/forms/JobExecutionDialog.tsx— in-package consumermigrated to source
requesterfromuseAccount().address;enablednow gates on a connected wallet.
package.json— bump0.1.2→0.2.0(minor signals breaking typeshape pre-1.0).
Consumer migration
Pass
useAccount().addressas the new requiredrequesterargument touseQuotes/useJobPrice/useJobPrices, and gateenabledon aconnected wallet so the address is non-zero when fetching begins.
Test plan
pnpm run typecheckpassespnpm run buildpasses (ESM + DTS)submit
createServiceFromQuotes, confirm tx lands on a v0.13.0contract
submitJobFromQuoteonce a v0.13.0 service is live