This repository has been archived by the owner on Dec 12, 2024. It is now read-only.
generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add `tbdex` submodule * add `json_schema` and `path` deps * remove unused pattern * generate id using `TypeId` * use `JsonSchema` * add `Validator` * progress on `verifyOfferingRequirements()` * fix validation errors * remove print * fix serialization issue with `requiredPaymentDetails` json schema * add `decimal` dep * add `orElse` to `firstWhere()` * add more exception handling to `verifyOfferingRequirements()` * change description in `having()` * add todo about explicit parsing * update `getOffering()` and `getRfq()` to test `verifyOfferingRequirements()` * add tests for `verifyOfferingRequirements()` * refactor `initialize()` * use `json` as variable name for `jsonEncode()` * update `tbdex` submodule * use private instance to initialize validator * add just command to copy json-schemas from tbdex submodule * remove initialize validator * check in json schemas from tbdex submodule * update path to new json-schemas folder * add get, test, and analyze * delete issue template * add ci workflow * update exception message * use `@` for all commands * update ci steps * add dart to hermit * fix property access on `dynamic` * add publish to none * move private constructor * fix metadata casts * remove unused constructor
- Loading branch information
Showing
40 changed files
with
849 additions
and
179 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
|
||
- name: Init Hermit | ||
uses: cashapp/activate-hermit@v1 | ||
with: | ||
cache: true | ||
|
||
- name: Install Dependencies | ||
run: just get | ||
|
||
- name: Run Static Analysis | ||
run: just analyze | ||
|
||
- name: Run Tests | ||
run: just test |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "tbdex"] | ||
path = tbdex | ||
url = [email protected]:TBD54566975/tbdex.git |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
schemas: | ||
@git submodule update --init --recursive | ||
@cp -r tbdex/hosted/json-schemas lib/src/protocol | ||
|
||
get: | ||
@dart pub get | ||
|
||
test: | ||
@dart test | ||
|
||
analyze: | ||
@dart analyze |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hermit |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hermit |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.dart-3.3.3.pkg |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.dart-3.3.3.pkg |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.dart-3.3.3.pkg |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.just-1.25.2.pkg |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "https://tbdex.dev/balance.schema.json", | ||
"type": "object", | ||
"properties": { | ||
"additionalProperties": false, | ||
"currencyCode": { | ||
"type": "string", | ||
"description": "ISO 3166 currency code string" | ||
}, | ||
"available": { | ||
"$ref": "definitions.json#/definitions/decimalString", | ||
"description": "The amount available to be transacted with" | ||
} | ||
}, | ||
"required": [ | ||
"currencyCode", | ||
"available" | ||
] | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "https://tbdex.dev/close.schema.json", | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"reason": { | ||
"type": "string" | ||
}, | ||
"success": { | ||
"type": "boolean" | ||
} | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "https://tbdex.dev/definitions.json", | ||
"type": "object", | ||
"definitions": { | ||
"did": { | ||
"type": "string", | ||
"pattern": "^did:([a-z0-9]+):((?:(?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))*:)*((?:[a-zA-Z0-9._-]|(?:%[0-9a-fA-F]{2}))+))((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(\/[^#?]*)?([?][^#]*)?(#.*)?$" | ||
}, | ||
"decimalString": { | ||
"type": "string", | ||
"pattern": "^([0-9]+(?:[.][0-9]+)?)$" | ||
} | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "https://tbdex.dev/message.schema.json", | ||
"definitions": { | ||
"MessageMetadata": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"from": { | ||
"$ref": "definitions.json#/definitions/did", | ||
"description": "The sender's DID" | ||
}, | ||
"to": { | ||
"$ref": "definitions.json#/definitions/did", | ||
"description": "The recipient's DID" | ||
}, | ||
"kind": { | ||
"type": "string", | ||
"enum": ["rfq", "quote", "order", "orderstatus", "close"], | ||
"description": "The message kind (e.g. rfq, quote)" | ||
}, | ||
"id": { | ||
"type": "string", | ||
"description": "The message ID" | ||
}, | ||
"exchangeId": { | ||
"type": "string", | ||
"description": "ID for a 'thread' of messages between Alice <-> PFI. Set by the first message in a thread" | ||
}, | ||
"externalId": { | ||
"type": "string", | ||
"description": "Arbitrary ID for the caller to associate with the message." | ||
}, | ||
"createdAt": { | ||
"type": "string", | ||
"description": "ISO8601 formatted string representing the timestamp" | ||
}, | ||
"protocol": { | ||
"type": "string", | ||
"description": "Version of the protocol in use (x.x format)" | ||
} | ||
}, | ||
"required": ["from", "to", "kind", "id", "exchangeId", "createdAt", "protocol"] | ||
}, | ||
"Private": { | ||
"type": "object", | ||
"description": "An ephemeral JSON object used to transmit sensitive data (e.g. PII)" | ||
} | ||
}, | ||
"type": "object", | ||
"properties": { | ||
"metadata": { | ||
"$ref": "#/definitions/MessageMetadata" | ||
}, | ||
"data": { | ||
"type": "object", | ||
"description": "The actual message content" | ||
}, | ||
"signature": { | ||
"type": "string", | ||
"description": "Signature that verifies the authenticity and integrity of a message" | ||
}, | ||
"private": { | ||
"$ref": "#/definitions/Private" | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"required": ["metadata", "data", "signature"] | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "https://tbdex.dev/offering.schema.json", | ||
"type": "object", | ||
"properties": { | ||
"additionalProperties": false, | ||
"description": { | ||
"type": "string", | ||
"description": "Brief description of what is being offered." | ||
}, | ||
"payin": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"currencyCode": { | ||
"type": "string", | ||
"description": "ISO 3166 currency code string" | ||
}, | ||
"min": { | ||
"$ref": "definitions.json#/definitions/decimalString", | ||
"description": "Minimum amount of currency that can be requested" | ||
}, | ||
"max": { | ||
"$ref": "definitions.json#/definitions/decimalString", | ||
"description": "Maximum amount of currency that can be requested" | ||
}, | ||
"methods": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"kind": { | ||
"type": "string", | ||
"description": "The type of payment method. e.g. BITCOIN_ADDRESS, DEBIT_CARD, etc." | ||
}, | ||
"name": { | ||
"type": "string", | ||
"description": "Payment Method name. Expected to be rendered on screen." | ||
}, | ||
"description": { | ||
"type": "string", | ||
"description": "Blurb containing helpful information about the payment method. Expected to be rendered on screen. e.g. \"segwit addresses only\"" | ||
}, | ||
"group": { | ||
"type": "string", | ||
"description": "Value that can be used to group specific payment methods together (e.g. Mobile Money vs. Direct Bank Deposit)." | ||
}, | ||
"requiredPaymentDetails": { | ||
"$ref": "http://json-schema.org/draft-07/schema", | ||
"description": "A JSON Schema containing the fields that need to be collected in order to use this payment method" | ||
}, | ||
"min": { | ||
"$ref": "definitions.json#/definitions/decimalString", | ||
"description": "Minimum amount required to use this payment method." | ||
}, | ||
"max": { | ||
"$ref": "definitions.json#/definitions/decimalString", | ||
"description": "Maximum amount allowed when using this payment method." | ||
}, | ||
"fee": { | ||
"$ref": "definitions.json#/definitions/decimalString", | ||
"description": "Fee charged to use this payment method. Absence of this field implies that there is no _additional_ fee associated to the respective payment method." | ||
} | ||
}, | ||
"required": ["kind"] | ||
} | ||
} | ||
}, | ||
"required": ["currencyCode", "methods"] | ||
}, | ||
"payout": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"currencyCode": { | ||
"type": "string", | ||
"description": "ISO 3166 currency code string" | ||
}, | ||
"min": { | ||
"$ref": "definitions.json#/definitions/decimalString", | ||
"description": "Minimum amount of currency that can be requested" | ||
}, | ||
"max": { | ||
"$ref": "definitions.json#/definitions/decimalString", | ||
"description": "Maximum amount of currency that can be requested" | ||
}, | ||
"methods": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"kind": { | ||
"type": "string", | ||
"description": "The type of payment method. e.g. BITCOIN_ADDRESS, DEBIT_CARD, etc." | ||
}, | ||
"name": { | ||
"type": "string", | ||
"description": "Payment Method name. Expected to be rendered on screen." | ||
}, | ||
"description": { | ||
"type": "string", | ||
"description": "Blurb containing helpful information about the payment method. Expected to be rendered on screen. e.g. \"segwit addresses only\"" | ||
}, | ||
"group": { | ||
"type": "string", | ||
"description": "Value that can be used to group specific payment methods together (e.g. Mobile Money vs. Direct Bank Deposit)." | ||
}, | ||
"requiredPaymentDetails": { | ||
"$ref": "http://json-schema.org/draft-07/schema", | ||
"description": "A JSON Schema containing the fields that need to be collected in order to use this payment method" | ||
}, | ||
"min": { | ||
"$ref": "definitions.json#/definitions/decimalString", | ||
"description": "Minimum amount required to use this payment method." | ||
}, | ||
"max": { | ||
"$ref": "definitions.json#/definitions/decimalString", | ||
"description": "Maximum amount allowed when using this payment method." | ||
}, | ||
"fee": { | ||
"$ref": "definitions.json#/definitions/decimalString", | ||
"description": "Fee charged to use this payment method. absence of this field implies that there is no _additional_ fee associated to the respective payment method" | ||
}, | ||
"estimatedSettlementTime": { | ||
"type": "number", | ||
"description": "Estimated time in seconds for the payout to be settled. e.g. 3600 for 1 hour. 0 for instant settlement.", | ||
"minimum": 0 | ||
} | ||
}, | ||
"required": ["kind", "estimatedSettlementTime"] | ||
} | ||
} | ||
}, | ||
"required": ["currencyCode", "methods"] | ||
}, | ||
"payoutUnitsPerPayinUnit": { | ||
"type": "string", | ||
"description": "Number of payout currency units for one payin currency unit (i.e 290000 USD for 1 BTC)" | ||
}, | ||
"requiredClaims": { | ||
"type": "object", | ||
"description": "PresentationDefinition that describes the credential(s) the PFI requires in order to provide a quote." | ||
} | ||
}, | ||
"required": [ | ||
"description", | ||
"payin", | ||
"payout", | ||
"payoutUnitsPerPayinUnit" | ||
] | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "https://tbdex.dev/order.schema.json", | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": {} | ||
} |
Oops, something went wrong.