From a403555e036e0aee0eec171fbb9692c201ecb61f Mon Sep 17 00:00:00 2001 From: Marc Juchli Date: Tue, 9 Dec 2025 18:59:23 +0100 Subject: [PATCH 1/4] fix: consolidate specs and fix open() Signed-off-by: Marc Juchli --- api-specs/openrpc-dapp-api.json | 93 ++-- api-specs/openrpc-dapp-remote-api.json | 422 +----------------- .../src/index.ts | 18 +- .../src/openrpc.json | 422 +----------------- core/wallet-dapp-rpc-client/src/index.ts | 5 + core/wallet-dapp-rpc-client/src/openrpc.json | 93 ++-- sdk/dapp-sdk/src/dapp-api/rpc-gen/typings.ts | 5 + sdk/dapp-sdk/src/provider.ts | 1 + sdk/dapp-sdk/src/provider/open.ts | 2 +- .../extension/src/dapp-api/rpc-gen/typings.ts | 5 + .../remote/src/dapp-api/rpc-gen/typings.ts | 18 +- .../remote/src/user-api/controller.ts | 6 +- .../remote/src/user-api/rpc-gen/typings.ts | 1 - 13 files changed, 172 insertions(+), 919 deletions(-) diff --git a/api-specs/openrpc-dapp-api.json b/api-specs/openrpc-dapp-api.json index e5ffc4199..3d4d239f6 100644 --- a/api-specs/openrpc-dapp-api.json +++ b/api-specs/openrpc-dapp-api.json @@ -12,7 +12,7 @@ "result": { "name": "result", "schema": { - "$ref": "#/components/schemas/StatusEvent" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/StatusEvent" } }, "description": "Returns the current status of the wallet gateway session." @@ -23,7 +23,7 @@ "result": { "name": "result", "schema": { - "$ref": "#/components/schemas/StatusEvent" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/StatusEvent" } }, "description": "Ensures ledger connectivity and returns the connected network information along with the user access token. Network ID should follow CAIP-2 and represent the synchronizerId." @@ -34,7 +34,7 @@ "result": { "name": "result", "schema": { - "$ref": "#/components/schemas/Null" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/Null" } }, "description": "Invoke a disconnect of the wallet gateway session." @@ -69,7 +69,7 @@ "name": "params", "schema": { "title": "prepareReturnParams", - "$ref": "#/components/schemas/JsPrepareSubmissionRequest" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/JsPrepareSubmissionRequest" } } ], @@ -79,7 +79,7 @@ "title": "prepareReturnResult", "properties": { "response": { - "$ref": "#/components/schemas/JsPrepareSubmissionResponse" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/JsPrepareSubmissionResponse" } }, "required": ["response"] @@ -94,7 +94,7 @@ "name": "params", "schema": { "title": "prepareExecuteParams", - "$ref": "#/components/schemas/JsPrepareSubmissionRequest" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/JsPrepareSubmissionRequest" } } ], @@ -105,7 +105,7 @@ "type": "object", "properties": { "tx": { - "$ref": "#/components/schemas/TxChangedExecutedEvent" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/TxChangedExecutedEvent" } }, "required": ["tx"] @@ -120,30 +120,14 @@ "name": "params", "schema": { "title": "ledgerApiParams", - "type": "object", - "properties": { - "requestMethod": { - "title": "requestMethod", - "type": "string", - "enum": ["GET", "POST", "PUT", "DELETE"] - }, - "resource": { - "title": "resource", - "type": "string" - }, - "body": { - "title": "body", - "type": "string" - } - }, - "required": ["requestMethod", "resource"] + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/LedgerApiRequest" } } ], "result": { "name": "result", "schema": { - "$ref": "#/components/schemas/LedgerApiResult" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/LedgerApiResult" } }, "description": "Proxy for the JSON-API endpoints. Injects authorization headers automatically." @@ -154,7 +138,7 @@ "result": { "name": "result", "schema": { - "$ref": "#/components/schemas/AccountsChangedEvent" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/AccountsChangedEvent" } } }, @@ -164,7 +148,7 @@ "result": { "name": "result", "schema": { - "$ref": "#/components/schemas/RequestAccountsResult" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/RequestAccountsResult" } }, "description": "Lists the addresses (wallets) with their properties; including which network they are associated to and with signing provider is used." @@ -175,7 +159,7 @@ "result": { "name": "result", "schema": { - "$ref": "#/components/schemas/TxChangedEvent" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/TxChangedEvent" } } } @@ -209,7 +193,7 @@ "description": "The URL of the Wallet Gateway." }, "userUrl": { - "$ref": "#/components/schemas/UserUrl" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/UserUrl" } }, "required": ["id", "clientType"] @@ -238,10 +222,10 @@ "description": "Structure representing the request for prepare and execute calls", "properties": { "commandId": { - "$ref": "#/components/schemas/CommandId" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/CommandId" }, "commands": { - "$ref": "#/components/schemas/JsCommands" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/JsCommands" }, "actAs": { "title": "actAs", @@ -266,7 +250,7 @@ "type": "array", "description": "List of contract IDs to be disclosed with the command.", "items": { - "$ref": "#/components/schemas/DisclosedContract" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/DisclosedContract" } }, "synchronizerId": { @@ -336,6 +320,27 @@ } } }, + "LedgerApiRequest": { + "title": "LedgerApiRequest", + "type": "object", + "description": "Ledger API request structure", + "properties": { + "requestMethod": { + "title": "requestMethod", + "type": "string", + "enum": ["GET", "POST", "PUT", "DELETE"] + }, + "resource": { + "title": "resource", + "type": "string" + }, + "body": { + "title": "body", + "type": "string" + } + }, + "required": ["requestMethod", "resource"] + }, "AccountsChangedEvent": { "title": "AccountsChangedEvent", "type": "array", @@ -370,7 +375,7 @@ "description": "The status of the transaction." }, "commandId": { - "$ref": "#/components/schemas/CommandId" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/CommandId" } }, "required": ["status", "commandId"] @@ -412,10 +417,10 @@ "description": "The status of the transaction." }, "commandId": { - "$ref": "#/components/schemas/CommandId" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/CommandId" }, "payload": { - "$ref": "#/components/schemas/TxChangedSignedPayload" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/TxChangedSignedPayload" } }, "required": ["status", "commandId", "payload"] @@ -451,10 +456,10 @@ "description": "The status of the transaction." }, "commandId": { - "$ref": "#/components/schemas/CommandId" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/CommandId" }, "payload": { - "$ref": "#/components/schemas/TxChangedExecutedPayload" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/TxChangedExecutedPayload" } }, "required": ["status", "commandId", "payload"] @@ -472,7 +477,7 @@ "description": "The status of the transaction." }, "commandId": { - "$ref": "#/components/schemas/CommandId" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/CommandId" } }, "required": ["status", "commandId"] @@ -482,16 +487,16 @@ "description": "Event emitted when a transaction changes.", "oneOf": [ { - "$ref": "#/components/schemas/TxChangedPendingEvent" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/TxChangedPendingEvent" }, { - "$ref": "#/components/schemas/TxChangedSignedEvent" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/TxChangedSignedEvent" }, { - "$ref": "#/components/schemas/TxChangedExecutedEvent" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/TxChangedExecutedEvent" }, { - "$ref": "#/components/schemas/TxChangedFailedEvent" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/TxChangedFailedEvent" } ] }, @@ -500,7 +505,7 @@ "type": "object", "properties": { "kernel": { - "$ref": "#/components/schemas/KernelInfo" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/KernelInfo" }, "isConnected": { "title": "isConnected", @@ -518,7 +523,7 @@ "description": "If not connected to a network, the reason why." }, "userUrl": { - "$ref": "#/components/schemas/UserUrl" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/UserUrl" }, "network": { "title": "network", diff --git a/api-specs/openrpc-dapp-remote-api.json b/api-specs/openrpc-dapp-remote-api.json index b7bc620d1..2c5e8a169 100644 --- a/api-specs/openrpc-dapp-remote-api.json +++ b/api-specs/openrpc-dapp-remote-api.json @@ -12,7 +12,7 @@ "result": { "name": "result", "schema": { - "$ref": "#/components/schemas/StatusEvent" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/StatusEvent" } }, "description": "Returns the current status of the wallet gateway session." @@ -23,7 +23,7 @@ "result": { "name": "result", "schema": { - "$ref": "#/components/schemas/StatusEvent" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/StatusEvent" } }, "description": "Ensures ledger connectivity and returns the connected network information along with the user access token. NetworkId should follow CAIP-2 and represent the synchronizerId." @@ -34,7 +34,7 @@ "result": { "name": "result", "schema": { - "$ref": "#/components/schemas/Null" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/Null" } }, "description": "Invoke a disconnect of the wallet gateway session." @@ -69,7 +69,7 @@ "name": "params", "schema": { "title": "prepareReturnParams", - "$ref": "#/components/schemas/JsPrepareSubmissionRequest" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/JsPrepareSubmissionRequest" } } ], @@ -79,7 +79,7 @@ "title": "prepareReturnResult", "properties": { "response": { - "$ref": "#/components/schemas/JsPrepareSubmissionResponse" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/JsPrepareSubmissionResponse" } }, "required": ["response"] @@ -94,7 +94,7 @@ "name": "params", "schema": { "title": "prepareExecuteParams", - "$ref": "#/components/schemas/JsPrepareSubmissionRequest" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/JsPrepareSubmissionRequest" } } ], @@ -105,7 +105,7 @@ "type": "object", "properties": { "userUrl": { - "$ref": "#/components/schemas/UserUrl" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/UserUrl" } }, "required": ["userUrl"] @@ -120,30 +120,14 @@ "name": "params", "schema": { "title": "ledgerApiParams", - "type": "object", - "properties": { - "requestMethod": { - "title": "requestMethod", - "type": "string", - "enum": ["GET", "POST", "PUT", "DELETE"] - }, - "resource": { - "title": "resource", - "type": "string" - }, - "body": { - "title": "body", - "type": "string" - } - }, - "required": ["requestMethod", "resource"] + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/LedgerApiRequest" } } ], "result": { "name": "result", "schema": { - "$ref": "#/components/schemas/LedgerApiResult" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/LedgerApiResult" } }, "description": "Proxy for the JSON-API endpoints. Injects authorization headers automatically." @@ -154,7 +138,7 @@ "result": { "name": "result", "schema": { - "$ref": "#/components/schemas/StatusEvent" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/StatusEvent" } }, "description": "Informs when the user connects to a network." @@ -165,7 +149,7 @@ "result": { "name": "result", "schema": { - "$ref": "#/components/schemas/StatusEvent" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/StatusEvent" } } }, @@ -175,7 +159,7 @@ "result": { "name": "result", "schema": { - "$ref": "#/components/schemas/AccountsChangedEvent" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/AccountsChangedEvent" } } }, @@ -185,7 +169,7 @@ "result": { "name": "result", "schema": { - "$ref": "#/components/schemas/RequestAccountsResult" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/RequestAccountsResult" } } }, @@ -195,7 +179,7 @@ "result": { "name": "result", "schema": { - "$ref": "#/components/schemas/TxChangedEvent" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/TxChangedEvent" } } } @@ -206,384 +190,6 @@ "title": "Null", "type": "null", "description": "Represents a null value, used in responses where no data is returned." - }, - "KernelInfo": { - "title": "KernelInfo", - "type": "object", - "description": "Represents a Wallet Gateway.", - "properties": { - "id": { - "title": "id", - "type": "string", - "description": "The unique identifier of the Wallet Gateway." - }, - "clientType": { - "title": "clientType", - "type": "string", - "enum": ["browser", "desktop", "mobile", "remote"], - "description": "The type of client that implements the Wallet Gateway." - }, - "url": { - "title": "url", - "type": "string", - "description": "The URL of the Wallet Gateway." - } - }, - "required": ["id", "clientType"] - }, - "LedgerApiResult": { - "title": "LedgerApiResult", - "type": "object", - "description": "Ledger Api configuration options", - "properties": { - "response": { - "title": "response", - "type": "string" - } - }, - "required": ["response"] - }, - "UserUrl": { - "title": "UserUrl", - "type": "string", - "format": "uri", - "description": "A URL that points to a user interface." - }, - "JsPrepareSubmissionRequest": { - "title": "JsPrepareSubmissionRequest", - "type": "object", - "description": "Structure representing the request for prepare and execute calls", - "properties": { - "commandId": { - "$ref": "#/components/schemas/CommandId" - }, - "commands": { - "$ref": "#/components/schemas/JsCommands" - }, - "actAs": { - "title": "actAs", - "type": "array", - "description": "Set of parties on whose behalf the command should be executed, if submitted. If not set, the primary wallet's party is used.", - "items": { - "title": "party", - "type": "string" - } - }, - "readAs": { - "title": "readAs", - "type": "array", - "description": "Set of parties that should be granted read access to the command, if submitted. If not set, no additional read parties are granted.", - "items": { - "title": "party", - "type": "string" - } - }, - "disclosedContracts": { - "title": "disclosedContracts", - "type": "array", - "description": "List of contract IDs to be disclosed with the command.", - "items": { - "$ref": "#/components/schemas/DisclosedContract" - } - }, - "synchronizerId": { - "title": "synchronizerId", - "type": "string", - "description": "If not set, a suitable synchronizer that this node is connected to will be chosen." - }, - "packageIdSelectionPreference": { - "title": "packageIdSelectionPreference", - "type": "array", - "description": "The package-id selection preference of the client for resolving package names and interface instances in command submission and interpretation", - "items": { - "title": "packageId", - "type": "string" - } - } - }, - "required": ["commands"] - }, - "DisclosedContract": { - "title": "DisclosedContract", - "type": "object", - "description": "Structure representing a disclosed contract for transaction execution", - "properties": { - "templateId": { - "title": "templateId", - "type": "string", - "description": "The template identifier of the disclosed contract." - }, - "contractId": { - "title": "contractId", - "type": "string", - "description": "The unique identifier of the disclosed contract." - }, - "createdEventBlob": { - "title": "createdEventBlob", - "type": "string", - "description": "The blob data of the created event for the disclosed contract." - }, - "synchronizerId": { - "title": "synchronizerId", - "type": "string", - "description": "The synchronizer identifier associated with the disclosed contract." - } - }, - "required": ["createdEventBlob"] - }, - "JsCommands": { - "title": "JsCommands", - "type": "object", - "description": "Structure representing JS commands for transaction execution" - }, - "JsPrepareSubmissionResponse": { - "title": "JsPrepareSubmissionResponse", - "type": "object", - "description": "Structure representing the result of a prepareReturn call", - "properties": { - "preparedTransaction": { - "title": "preparedTransaction", - "type": "string", - "description": "The prepared transaction data." - }, - "preparedTransactionHash": { - "title": "preparedTransactionHash", - "type": "string", - "description": "The hash of the prepared transaction." - } - } - }, - "AccountsChangedEvent": { - "title": "AccountsChangedEvent", - "type": "array", - "description": "Event emitted when the user's accounts change.", - "items": { - "$ref": "api-specs/openrpc-user-api.json#/components/schemas/Wallet" - } - }, - "RequestAccountsResult": { - "title": "RequestAccountsResult", - "type": "array", - "description": "An array of accounts that the user has authorized the dapp to access..", - "items": { - "$ref": "api-specs/openrpc-user-api.json#/components/schemas/Wallet" - } - }, - "CommandId": { - "title": "CommandId", - "type": "string", - "description": "The unique identifier of the command associated with the transaction." - }, - "TxChangedPendingEvent": { - "title": "TxChangedPendingEvent", - "description": "Event emitted when a transaction is pending.", - "type": "object", - "additionalProperties": false, - "properties": { - "status": { - "title": "statusPending", - "type": "string", - "enum": ["pending"], - "description": "The status of the transaction." - }, - "commandId": { - "$ref": "#/components/schemas/CommandId" - } - }, - "required": ["status", "commandId"] - }, - "TxChangedSignedPayload": { - "type": "object", - "title": "TxChangedSignedPayload", - "description": "Payload for the TxChangedSignedEvent.", - "additionalProperties": false, - "properties": { - "signature": { - "title": "signature", - "type": "string", - "description": "The signature of the transaction." - }, - "signedBy": { - "title": "signedBy", - "type": "string", - "description": "The identifier of the provider that signed the transaction." - }, - "party": { - "title": "party", - "type": "string", - "description": "The party that signed the transaction." - } - }, - "required": ["signature", "signedBy", "party"] - }, - "TxChangedSignedEvent": { - "title": "TxChangedSignedEvent", - "description": "Event emitted when a transaction has been signed.", - "type": "object", - "additionalProperties": false, - "properties": { - "status": { - "title": "statusSigned", - "type": "string", - "enum": ["signed"], - "description": "The status of the transaction." - }, - "commandId": { - "$ref": "#/components/schemas/CommandId" - }, - "payload": { - "$ref": "#/components/schemas/TxChangedSignedPayload" - } - }, - "required": ["status", "commandId", "payload"] - }, - "TxChangedExecutedPayload": { - "type": "object", - "title": "TxChangedExecutedPayload", - "description": "Payload for the TxChangedExecutedEvent.", - "additionalProperties": false, - "properties": { - "updateId": { - "title": "updateId", - "type": "string", - "description": "The update ID corresponding to the transaction." - }, - "completionOffset": { - "title": "completionOffset", - "type": "integer" - } - }, - "required": ["updateId", "completionOffset"] - }, - "TxChangedExecutedEvent": { - "title": "TxChangedExecutedEvent", - "description": "Event emitted when a transaction is executed against the participant.", - "type": "object", - "additionalProperties": false, - "properties": { - "status": { - "title": "statusExecuted", - "type": "string", - "enum": ["executed"], - "description": "The status of the transaction." - }, - "commandId": { - "$ref": "#/components/schemas/CommandId" - }, - "payload": { - "$ref": "#/components/schemas/TxChangedExecutedPayload" - } - }, - "required": ["status", "commandId", "payload"] - }, - "TxChangedFailedEvent": { - "title": "TxChangedFailedEvent", - "description": "Event emitted when a transaction has failed.", - "type": "object", - "additionalProperties": false, - "properties": { - "status": { - "title": "statusFailed", - "type": "string", - "enum": ["failed"], - "description": "The status of the transaction." - }, - "commandId": { - "$ref": "#/components/schemas/CommandId" - } - }, - "required": ["status", "commandId"] - }, - "TxChangedEvent": { - "title": "TxChangedEvent", - "description": "Event emitted when a transaction changes.", - "oneOf": [ - { - "$ref": "#/components/schemas/TxChangedPendingEvent" - }, - { - "$ref": "#/components/schemas/TxChangedSignedEvent" - }, - { - "$ref": "#/components/schemas/TxChangedExecutedEvent" - }, - { - "$ref": "#/components/schemas/TxChangedFailedEvent" - } - ] - }, - "StatusEvent": { - "title": "StatusEvent", - "type": "object", - "properties": { - "kernel": { - "$ref": "#/components/schemas/KernelInfo" - }, - "isConnected": { - "title": "isConnected", - "type": "boolean", - "description": "Whether or not the user is authenticated with the Wallet." - }, - "isNetworkConnected": { - "title": "isNetworkConnected", - "type": "boolean", - "description": "Whether or not a connection to a network is established." - }, - "networkReason": { - "title": "networkReason", - "type": "string", - "description": "If not connected to a network, the reason why." - }, - "userUrl": { - "$ref": "#/components/schemas/UserUrl" - }, - "network": { - "title": "network", - "type": "object", - "description": "Network information, if connected to a network.", - "properties": { - "networkId": { - "title": "networkId", - "type": "string", - "description": "A CAIP-2 compliant chain ID, e.g. 'canton:da-mainnet'." - }, - "ledgerApi": { - "title": "LedgerApiConfig", - "type": "object", - "description": "Ledger API configuration.", - "properties": { - "baseUrl": { - "title": "baseUrl", - "type": "string", - "format": "uri", - "description": "The base URL of the ledger API." - } - }, - "required": ["baseUrl"] - } - }, - "required": ["networkId"] - }, - "session": { - "title": "session", - "type": "object", - "description": "Session information, if authenticated.", - "properties": { - "accessToken": { - "title": "accessToken", - "type": "string", - "description": "JWT authentication token." - }, - "userId": { - "title": "userId", - "type": "string", - "description": "The user identifier." - } - }, - "required": ["accessToken", "userId"] - } - }, - "required": ["kernel", "isConnected", "isNetworkConnected"] } } } diff --git a/core/wallet-dapp-remote-rpc-client/src/index.ts b/core/wallet-dapp-remote-rpc-client/src/index.ts index 08db76f2f..f91f2698f 100644 --- a/core/wallet-dapp-remote-rpc-client/src/index.ts +++ b/core/wallet-dapp-remote-rpc-client/src/index.ts @@ -105,6 +105,12 @@ export type ClientType = 'browser' | 'desktop' | 'mobile' | 'remote' * */ export type Url = string +/** + * + * A URL that points to a user interface. + * + */ +export type UserUrl = string /** * * Represents a Wallet Gateway. @@ -114,6 +120,7 @@ export interface KernelInfo { id: Id clientType: ClientType url?: Url + userUrl?: UserUrl [k: string]: any } /** @@ -134,12 +141,6 @@ export type IsNetworkConnected = boolean * */ export type NetworkReason = string -/** - * - * A URL that points to a user interface. - * - */ -export type UserUrl = string /** * * The network ID the wallet corresponds to. @@ -420,6 +421,11 @@ export interface PrepareExecuteParams { packageIdSelectionPreference?: PackageIdSelectionPreference [k: string]: any } +/** + * + * Ledger API request structure + * + */ export interface LedgerApiParams { requestMethod: RequestMethod resource: Resource diff --git a/core/wallet-dapp-remote-rpc-client/src/openrpc.json b/core/wallet-dapp-remote-rpc-client/src/openrpc.json index b7bc620d1..2c5e8a169 100644 --- a/core/wallet-dapp-remote-rpc-client/src/openrpc.json +++ b/core/wallet-dapp-remote-rpc-client/src/openrpc.json @@ -12,7 +12,7 @@ "result": { "name": "result", "schema": { - "$ref": "#/components/schemas/StatusEvent" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/StatusEvent" } }, "description": "Returns the current status of the wallet gateway session." @@ -23,7 +23,7 @@ "result": { "name": "result", "schema": { - "$ref": "#/components/schemas/StatusEvent" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/StatusEvent" } }, "description": "Ensures ledger connectivity and returns the connected network information along with the user access token. NetworkId should follow CAIP-2 and represent the synchronizerId." @@ -34,7 +34,7 @@ "result": { "name": "result", "schema": { - "$ref": "#/components/schemas/Null" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/Null" } }, "description": "Invoke a disconnect of the wallet gateway session." @@ -69,7 +69,7 @@ "name": "params", "schema": { "title": "prepareReturnParams", - "$ref": "#/components/schemas/JsPrepareSubmissionRequest" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/JsPrepareSubmissionRequest" } } ], @@ -79,7 +79,7 @@ "title": "prepareReturnResult", "properties": { "response": { - "$ref": "#/components/schemas/JsPrepareSubmissionResponse" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/JsPrepareSubmissionResponse" } }, "required": ["response"] @@ -94,7 +94,7 @@ "name": "params", "schema": { "title": "prepareExecuteParams", - "$ref": "#/components/schemas/JsPrepareSubmissionRequest" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/JsPrepareSubmissionRequest" } } ], @@ -105,7 +105,7 @@ "type": "object", "properties": { "userUrl": { - "$ref": "#/components/schemas/UserUrl" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/UserUrl" } }, "required": ["userUrl"] @@ -120,30 +120,14 @@ "name": "params", "schema": { "title": "ledgerApiParams", - "type": "object", - "properties": { - "requestMethod": { - "title": "requestMethod", - "type": "string", - "enum": ["GET", "POST", "PUT", "DELETE"] - }, - "resource": { - "title": "resource", - "type": "string" - }, - "body": { - "title": "body", - "type": "string" - } - }, - "required": ["requestMethod", "resource"] + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/LedgerApiRequest" } } ], "result": { "name": "result", "schema": { - "$ref": "#/components/schemas/LedgerApiResult" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/LedgerApiResult" } }, "description": "Proxy for the JSON-API endpoints. Injects authorization headers automatically." @@ -154,7 +138,7 @@ "result": { "name": "result", "schema": { - "$ref": "#/components/schemas/StatusEvent" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/StatusEvent" } }, "description": "Informs when the user connects to a network." @@ -165,7 +149,7 @@ "result": { "name": "result", "schema": { - "$ref": "#/components/schemas/StatusEvent" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/StatusEvent" } } }, @@ -175,7 +159,7 @@ "result": { "name": "result", "schema": { - "$ref": "#/components/schemas/AccountsChangedEvent" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/AccountsChangedEvent" } } }, @@ -185,7 +169,7 @@ "result": { "name": "result", "schema": { - "$ref": "#/components/schemas/RequestAccountsResult" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/RequestAccountsResult" } } }, @@ -195,7 +179,7 @@ "result": { "name": "result", "schema": { - "$ref": "#/components/schemas/TxChangedEvent" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/TxChangedEvent" } } } @@ -206,384 +190,6 @@ "title": "Null", "type": "null", "description": "Represents a null value, used in responses where no data is returned." - }, - "KernelInfo": { - "title": "KernelInfo", - "type": "object", - "description": "Represents a Wallet Gateway.", - "properties": { - "id": { - "title": "id", - "type": "string", - "description": "The unique identifier of the Wallet Gateway." - }, - "clientType": { - "title": "clientType", - "type": "string", - "enum": ["browser", "desktop", "mobile", "remote"], - "description": "The type of client that implements the Wallet Gateway." - }, - "url": { - "title": "url", - "type": "string", - "description": "The URL of the Wallet Gateway." - } - }, - "required": ["id", "clientType"] - }, - "LedgerApiResult": { - "title": "LedgerApiResult", - "type": "object", - "description": "Ledger Api configuration options", - "properties": { - "response": { - "title": "response", - "type": "string" - } - }, - "required": ["response"] - }, - "UserUrl": { - "title": "UserUrl", - "type": "string", - "format": "uri", - "description": "A URL that points to a user interface." - }, - "JsPrepareSubmissionRequest": { - "title": "JsPrepareSubmissionRequest", - "type": "object", - "description": "Structure representing the request for prepare and execute calls", - "properties": { - "commandId": { - "$ref": "#/components/schemas/CommandId" - }, - "commands": { - "$ref": "#/components/schemas/JsCommands" - }, - "actAs": { - "title": "actAs", - "type": "array", - "description": "Set of parties on whose behalf the command should be executed, if submitted. If not set, the primary wallet's party is used.", - "items": { - "title": "party", - "type": "string" - } - }, - "readAs": { - "title": "readAs", - "type": "array", - "description": "Set of parties that should be granted read access to the command, if submitted. If not set, no additional read parties are granted.", - "items": { - "title": "party", - "type": "string" - } - }, - "disclosedContracts": { - "title": "disclosedContracts", - "type": "array", - "description": "List of contract IDs to be disclosed with the command.", - "items": { - "$ref": "#/components/schemas/DisclosedContract" - } - }, - "synchronizerId": { - "title": "synchronizerId", - "type": "string", - "description": "If not set, a suitable synchronizer that this node is connected to will be chosen." - }, - "packageIdSelectionPreference": { - "title": "packageIdSelectionPreference", - "type": "array", - "description": "The package-id selection preference of the client for resolving package names and interface instances in command submission and interpretation", - "items": { - "title": "packageId", - "type": "string" - } - } - }, - "required": ["commands"] - }, - "DisclosedContract": { - "title": "DisclosedContract", - "type": "object", - "description": "Structure representing a disclosed contract for transaction execution", - "properties": { - "templateId": { - "title": "templateId", - "type": "string", - "description": "The template identifier of the disclosed contract." - }, - "contractId": { - "title": "contractId", - "type": "string", - "description": "The unique identifier of the disclosed contract." - }, - "createdEventBlob": { - "title": "createdEventBlob", - "type": "string", - "description": "The blob data of the created event for the disclosed contract." - }, - "synchronizerId": { - "title": "synchronizerId", - "type": "string", - "description": "The synchronizer identifier associated with the disclosed contract." - } - }, - "required": ["createdEventBlob"] - }, - "JsCommands": { - "title": "JsCommands", - "type": "object", - "description": "Structure representing JS commands for transaction execution" - }, - "JsPrepareSubmissionResponse": { - "title": "JsPrepareSubmissionResponse", - "type": "object", - "description": "Structure representing the result of a prepareReturn call", - "properties": { - "preparedTransaction": { - "title": "preparedTransaction", - "type": "string", - "description": "The prepared transaction data." - }, - "preparedTransactionHash": { - "title": "preparedTransactionHash", - "type": "string", - "description": "The hash of the prepared transaction." - } - } - }, - "AccountsChangedEvent": { - "title": "AccountsChangedEvent", - "type": "array", - "description": "Event emitted when the user's accounts change.", - "items": { - "$ref": "api-specs/openrpc-user-api.json#/components/schemas/Wallet" - } - }, - "RequestAccountsResult": { - "title": "RequestAccountsResult", - "type": "array", - "description": "An array of accounts that the user has authorized the dapp to access..", - "items": { - "$ref": "api-specs/openrpc-user-api.json#/components/schemas/Wallet" - } - }, - "CommandId": { - "title": "CommandId", - "type": "string", - "description": "The unique identifier of the command associated with the transaction." - }, - "TxChangedPendingEvent": { - "title": "TxChangedPendingEvent", - "description": "Event emitted when a transaction is pending.", - "type": "object", - "additionalProperties": false, - "properties": { - "status": { - "title": "statusPending", - "type": "string", - "enum": ["pending"], - "description": "The status of the transaction." - }, - "commandId": { - "$ref": "#/components/schemas/CommandId" - } - }, - "required": ["status", "commandId"] - }, - "TxChangedSignedPayload": { - "type": "object", - "title": "TxChangedSignedPayload", - "description": "Payload for the TxChangedSignedEvent.", - "additionalProperties": false, - "properties": { - "signature": { - "title": "signature", - "type": "string", - "description": "The signature of the transaction." - }, - "signedBy": { - "title": "signedBy", - "type": "string", - "description": "The identifier of the provider that signed the transaction." - }, - "party": { - "title": "party", - "type": "string", - "description": "The party that signed the transaction." - } - }, - "required": ["signature", "signedBy", "party"] - }, - "TxChangedSignedEvent": { - "title": "TxChangedSignedEvent", - "description": "Event emitted when a transaction has been signed.", - "type": "object", - "additionalProperties": false, - "properties": { - "status": { - "title": "statusSigned", - "type": "string", - "enum": ["signed"], - "description": "The status of the transaction." - }, - "commandId": { - "$ref": "#/components/schemas/CommandId" - }, - "payload": { - "$ref": "#/components/schemas/TxChangedSignedPayload" - } - }, - "required": ["status", "commandId", "payload"] - }, - "TxChangedExecutedPayload": { - "type": "object", - "title": "TxChangedExecutedPayload", - "description": "Payload for the TxChangedExecutedEvent.", - "additionalProperties": false, - "properties": { - "updateId": { - "title": "updateId", - "type": "string", - "description": "The update ID corresponding to the transaction." - }, - "completionOffset": { - "title": "completionOffset", - "type": "integer" - } - }, - "required": ["updateId", "completionOffset"] - }, - "TxChangedExecutedEvent": { - "title": "TxChangedExecutedEvent", - "description": "Event emitted when a transaction is executed against the participant.", - "type": "object", - "additionalProperties": false, - "properties": { - "status": { - "title": "statusExecuted", - "type": "string", - "enum": ["executed"], - "description": "The status of the transaction." - }, - "commandId": { - "$ref": "#/components/schemas/CommandId" - }, - "payload": { - "$ref": "#/components/schemas/TxChangedExecutedPayload" - } - }, - "required": ["status", "commandId", "payload"] - }, - "TxChangedFailedEvent": { - "title": "TxChangedFailedEvent", - "description": "Event emitted when a transaction has failed.", - "type": "object", - "additionalProperties": false, - "properties": { - "status": { - "title": "statusFailed", - "type": "string", - "enum": ["failed"], - "description": "The status of the transaction." - }, - "commandId": { - "$ref": "#/components/schemas/CommandId" - } - }, - "required": ["status", "commandId"] - }, - "TxChangedEvent": { - "title": "TxChangedEvent", - "description": "Event emitted when a transaction changes.", - "oneOf": [ - { - "$ref": "#/components/schemas/TxChangedPendingEvent" - }, - { - "$ref": "#/components/schemas/TxChangedSignedEvent" - }, - { - "$ref": "#/components/schemas/TxChangedExecutedEvent" - }, - { - "$ref": "#/components/schemas/TxChangedFailedEvent" - } - ] - }, - "StatusEvent": { - "title": "StatusEvent", - "type": "object", - "properties": { - "kernel": { - "$ref": "#/components/schemas/KernelInfo" - }, - "isConnected": { - "title": "isConnected", - "type": "boolean", - "description": "Whether or not the user is authenticated with the Wallet." - }, - "isNetworkConnected": { - "title": "isNetworkConnected", - "type": "boolean", - "description": "Whether or not a connection to a network is established." - }, - "networkReason": { - "title": "networkReason", - "type": "string", - "description": "If not connected to a network, the reason why." - }, - "userUrl": { - "$ref": "#/components/schemas/UserUrl" - }, - "network": { - "title": "network", - "type": "object", - "description": "Network information, if connected to a network.", - "properties": { - "networkId": { - "title": "networkId", - "type": "string", - "description": "A CAIP-2 compliant chain ID, e.g. 'canton:da-mainnet'." - }, - "ledgerApi": { - "title": "LedgerApiConfig", - "type": "object", - "description": "Ledger API configuration.", - "properties": { - "baseUrl": { - "title": "baseUrl", - "type": "string", - "format": "uri", - "description": "The base URL of the ledger API." - } - }, - "required": ["baseUrl"] - } - }, - "required": ["networkId"] - }, - "session": { - "title": "session", - "type": "object", - "description": "Session information, if authenticated.", - "properties": { - "accessToken": { - "title": "accessToken", - "type": "string", - "description": "JWT authentication token." - }, - "userId": { - "title": "userId", - "type": "string", - "description": "The user identifier." - } - }, - "required": ["accessToken", "userId"] - } - }, - "required": ["kernel", "isConnected", "isNetworkConnected"] } } } diff --git a/core/wallet-dapp-rpc-client/src/index.ts b/core/wallet-dapp-rpc-client/src/index.ts index 5542a3485..285d7cfbb 100644 --- a/core/wallet-dapp-rpc-client/src/index.ts +++ b/core/wallet-dapp-rpc-client/src/index.ts @@ -421,6 +421,11 @@ export interface PrepareExecuteParams { packageIdSelectionPreference?: PackageIdSelectionPreference [k: string]: any } +/** + * + * Ledger API request structure + * + */ export interface LedgerApiParams { requestMethod: RequestMethod resource: Resource diff --git a/core/wallet-dapp-rpc-client/src/openrpc.json b/core/wallet-dapp-rpc-client/src/openrpc.json index e5ffc4199..3d4d239f6 100644 --- a/core/wallet-dapp-rpc-client/src/openrpc.json +++ b/core/wallet-dapp-rpc-client/src/openrpc.json @@ -12,7 +12,7 @@ "result": { "name": "result", "schema": { - "$ref": "#/components/schemas/StatusEvent" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/StatusEvent" } }, "description": "Returns the current status of the wallet gateway session." @@ -23,7 +23,7 @@ "result": { "name": "result", "schema": { - "$ref": "#/components/schemas/StatusEvent" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/StatusEvent" } }, "description": "Ensures ledger connectivity and returns the connected network information along with the user access token. Network ID should follow CAIP-2 and represent the synchronizerId." @@ -34,7 +34,7 @@ "result": { "name": "result", "schema": { - "$ref": "#/components/schemas/Null" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/Null" } }, "description": "Invoke a disconnect of the wallet gateway session." @@ -69,7 +69,7 @@ "name": "params", "schema": { "title": "prepareReturnParams", - "$ref": "#/components/schemas/JsPrepareSubmissionRequest" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/JsPrepareSubmissionRequest" } } ], @@ -79,7 +79,7 @@ "title": "prepareReturnResult", "properties": { "response": { - "$ref": "#/components/schemas/JsPrepareSubmissionResponse" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/JsPrepareSubmissionResponse" } }, "required": ["response"] @@ -94,7 +94,7 @@ "name": "params", "schema": { "title": "prepareExecuteParams", - "$ref": "#/components/schemas/JsPrepareSubmissionRequest" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/JsPrepareSubmissionRequest" } } ], @@ -105,7 +105,7 @@ "type": "object", "properties": { "tx": { - "$ref": "#/components/schemas/TxChangedExecutedEvent" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/TxChangedExecutedEvent" } }, "required": ["tx"] @@ -120,30 +120,14 @@ "name": "params", "schema": { "title": "ledgerApiParams", - "type": "object", - "properties": { - "requestMethod": { - "title": "requestMethod", - "type": "string", - "enum": ["GET", "POST", "PUT", "DELETE"] - }, - "resource": { - "title": "resource", - "type": "string" - }, - "body": { - "title": "body", - "type": "string" - } - }, - "required": ["requestMethod", "resource"] + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/LedgerApiRequest" } } ], "result": { "name": "result", "schema": { - "$ref": "#/components/schemas/LedgerApiResult" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/LedgerApiResult" } }, "description": "Proxy for the JSON-API endpoints. Injects authorization headers automatically." @@ -154,7 +138,7 @@ "result": { "name": "result", "schema": { - "$ref": "#/components/schemas/AccountsChangedEvent" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/AccountsChangedEvent" } } }, @@ -164,7 +148,7 @@ "result": { "name": "result", "schema": { - "$ref": "#/components/schemas/RequestAccountsResult" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/RequestAccountsResult" } }, "description": "Lists the addresses (wallets) with their properties; including which network they are associated to and with signing provider is used." @@ -175,7 +159,7 @@ "result": { "name": "result", "schema": { - "$ref": "#/components/schemas/TxChangedEvent" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/TxChangedEvent" } } } @@ -209,7 +193,7 @@ "description": "The URL of the Wallet Gateway." }, "userUrl": { - "$ref": "#/components/schemas/UserUrl" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/UserUrl" } }, "required": ["id", "clientType"] @@ -238,10 +222,10 @@ "description": "Structure representing the request for prepare and execute calls", "properties": { "commandId": { - "$ref": "#/components/schemas/CommandId" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/CommandId" }, "commands": { - "$ref": "#/components/schemas/JsCommands" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/JsCommands" }, "actAs": { "title": "actAs", @@ -266,7 +250,7 @@ "type": "array", "description": "List of contract IDs to be disclosed with the command.", "items": { - "$ref": "#/components/schemas/DisclosedContract" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/DisclosedContract" } }, "synchronizerId": { @@ -336,6 +320,27 @@ } } }, + "LedgerApiRequest": { + "title": "LedgerApiRequest", + "type": "object", + "description": "Ledger API request structure", + "properties": { + "requestMethod": { + "title": "requestMethod", + "type": "string", + "enum": ["GET", "POST", "PUT", "DELETE"] + }, + "resource": { + "title": "resource", + "type": "string" + }, + "body": { + "title": "body", + "type": "string" + } + }, + "required": ["requestMethod", "resource"] + }, "AccountsChangedEvent": { "title": "AccountsChangedEvent", "type": "array", @@ -370,7 +375,7 @@ "description": "The status of the transaction." }, "commandId": { - "$ref": "#/components/schemas/CommandId" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/CommandId" } }, "required": ["status", "commandId"] @@ -412,10 +417,10 @@ "description": "The status of the transaction." }, "commandId": { - "$ref": "#/components/schemas/CommandId" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/CommandId" }, "payload": { - "$ref": "#/components/schemas/TxChangedSignedPayload" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/TxChangedSignedPayload" } }, "required": ["status", "commandId", "payload"] @@ -451,10 +456,10 @@ "description": "The status of the transaction." }, "commandId": { - "$ref": "#/components/schemas/CommandId" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/CommandId" }, "payload": { - "$ref": "#/components/schemas/TxChangedExecutedPayload" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/TxChangedExecutedPayload" } }, "required": ["status", "commandId", "payload"] @@ -472,7 +477,7 @@ "description": "The status of the transaction." }, "commandId": { - "$ref": "#/components/schemas/CommandId" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/CommandId" } }, "required": ["status", "commandId"] @@ -482,16 +487,16 @@ "description": "Event emitted when a transaction changes.", "oneOf": [ { - "$ref": "#/components/schemas/TxChangedPendingEvent" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/TxChangedPendingEvent" }, { - "$ref": "#/components/schemas/TxChangedSignedEvent" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/TxChangedSignedEvent" }, { - "$ref": "#/components/schemas/TxChangedExecutedEvent" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/TxChangedExecutedEvent" }, { - "$ref": "#/components/schemas/TxChangedFailedEvent" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/TxChangedFailedEvent" } ] }, @@ -500,7 +505,7 @@ "type": "object", "properties": { "kernel": { - "$ref": "#/components/schemas/KernelInfo" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/KernelInfo" }, "isConnected": { "title": "isConnected", @@ -518,7 +523,7 @@ "description": "If not connected to a network, the reason why." }, "userUrl": { - "$ref": "#/components/schemas/UserUrl" + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/UserUrl" }, "network": { "title": "network", diff --git a/sdk/dapp-sdk/src/dapp-api/rpc-gen/typings.ts b/sdk/dapp-sdk/src/dapp-api/rpc-gen/typings.ts index 546e1e4d8..82ceeac7a 100644 --- a/sdk/dapp-sdk/src/dapp-api/rpc-gen/typings.ts +++ b/sdk/dapp-sdk/src/dapp-api/rpc-gen/typings.ts @@ -421,6 +421,11 @@ export interface PrepareExecuteParams { packageIdSelectionPreference?: PackageIdSelectionPreference [k: string]: any } +/** + * + * Ledger API request structure + * + */ export interface LedgerApiParams { requestMethod: RequestMethod resource: Resource diff --git a/sdk/dapp-sdk/src/provider.ts b/sdk/dapp-sdk/src/provider.ts index 0471ac8a4..a709f5f6c 100644 --- a/sdk/dapp-sdk/src/provider.ts +++ b/sdk/dapp-sdk/src/provider.ts @@ -171,6 +171,7 @@ export const dappController = (provider: SpliceProvider) => provider.on( 'onConnected', (event) => { + console.log('SDK: onConnected event', event) clearTimeout(timeout) resolve(event) } diff --git a/sdk/dapp-sdk/src/provider/open.ts b/sdk/dapp-sdk/src/provider/open.ts index b08de093b..7b049ac65 100644 --- a/sdk/dapp-sdk/src/provider/open.ts +++ b/sdk/dapp-sdk/src/provider/open.ts @@ -15,5 +15,5 @@ export async function open(): Promise { throw new Error('No previous session found') } - openKernelUserUI(discovery.walletType, session.status.kernel.userUrl ?? '') + openKernelUserUI(discovery.walletType, session.kernel.userUrl ?? '') } diff --git a/wallet-gateway/extension/src/dapp-api/rpc-gen/typings.ts b/wallet-gateway/extension/src/dapp-api/rpc-gen/typings.ts index 546e1e4d8..82ceeac7a 100644 --- a/wallet-gateway/extension/src/dapp-api/rpc-gen/typings.ts +++ b/wallet-gateway/extension/src/dapp-api/rpc-gen/typings.ts @@ -421,6 +421,11 @@ export interface PrepareExecuteParams { packageIdSelectionPreference?: PackageIdSelectionPreference [k: string]: any } +/** + * + * Ledger API request structure + * + */ export interface LedgerApiParams { requestMethod: RequestMethod resource: Resource diff --git a/wallet-gateway/remote/src/dapp-api/rpc-gen/typings.ts b/wallet-gateway/remote/src/dapp-api/rpc-gen/typings.ts index 8c9616eb7..3d3735dd2 100644 --- a/wallet-gateway/remote/src/dapp-api/rpc-gen/typings.ts +++ b/wallet-gateway/remote/src/dapp-api/rpc-gen/typings.ts @@ -105,6 +105,12 @@ export type ClientType = 'browser' | 'desktop' | 'mobile' | 'remote' * */ export type Url = string +/** + * + * A URL that points to a user interface. + * + */ +export type UserUrl = string /** * * Represents a Wallet Gateway. @@ -114,6 +120,7 @@ export interface KernelInfo { id: Id clientType: ClientType url?: Url + userUrl?: UserUrl [k: string]: any } /** @@ -134,12 +141,6 @@ export type IsNetworkConnected = boolean * */ export type NetworkReason = string -/** - * - * A URL that points to a user interface. - * - */ -export type UserUrl = string /** * * The network ID the wallet corresponds to. @@ -420,6 +421,11 @@ export interface PrepareExecuteParams { packageIdSelectionPreference?: PackageIdSelectionPreference [k: string]: any } +/** + * + * Ledger API request structure + * + */ export interface LedgerApiParams { requestMethod: RequestMethod resource: Resource diff --git a/wallet-gateway/remote/src/user-api/controller.ts b/wallet-gateway/remote/src/user-api/controller.ts index 1dbdf0c64..9fc9e1c7e 100644 --- a/wallet-gateway/remote/src/user-api/controller.ts +++ b/wallet-gateway/remote/src/user-api/controller.ts @@ -55,6 +55,7 @@ import { ledgerPrepareParams, } from '../utils.js' import { StatusEvent } from '../dapp-api/rpc-gen/typings.js' +import { user } from './server.js' type AvailableSigningDrivers = Partial< Record @@ -586,7 +587,10 @@ export const userController = ( }) const status = await networkStatus(ledgerClient) notifier.emit('onConnected', { - kernel: kernelInfo, + kernel: { + ...kernelInfo, + userUrl: `${userUrl}/login/`, + }, isConnected: true, isNetworkConnected: status.isConnected, networkReason: status.reason ? status.reason : 'OK', diff --git a/wallet-gateway/remote/src/user-api/rpc-gen/typings.ts b/wallet-gateway/remote/src/user-api/rpc-gen/typings.ts index 7ca2c7b05..d70933aed 100644 --- a/wallet-gateway/remote/src/user-api/rpc-gen/typings.ts +++ b/wallet-gateway/remote/src/user-api/rpc-gen/typings.ts @@ -342,7 +342,6 @@ export interface ExecuteParams { } export interface AddSessionParams { networkId: NetworkId - idp: Idp [k: string]: any } export interface GetTransactionParams { From 2608e034dabba1b09a61ca4c3ec54fd96dc27716 Mon Sep 17 00:00:00 2001 From: Marc Juchli Date: Wed, 10 Dec 2025 14:35:23 +0100 Subject: [PATCH 2/4] extend userUrl Signed-off-by: Marc Juchli --- api-specs/openrpc-dapp-api.json | 3 --- api-specs/openrpc-dapp-remote-api.json | 16 +++++++++++- .../src/index.ts | 26 +++++++++++-------- .../src/openrpc.json | 16 +++++++++++- core/wallet-dapp-rpc-client/src/index.ts | 1 - core/wallet-dapp-rpc-client/src/openrpc.json | 3 --- sdk/dapp-sdk/src/dapp-api/rpc-gen/typings.ts | 1 - .../extension/src/dapp-api/rpc-gen/typings.ts | 1 - .../remote/src/dapp-api/controller.ts | 5 ++-- .../remote/src/dapp-api/rpc-gen/typings.ts | 26 +++++++++++-------- .../remote/src/user-api/controller.ts | 1 - 11 files changed, 63 insertions(+), 36 deletions(-) diff --git a/api-specs/openrpc-dapp-api.json b/api-specs/openrpc-dapp-api.json index 3d4d239f6..3b9d71e70 100644 --- a/api-specs/openrpc-dapp-api.json +++ b/api-specs/openrpc-dapp-api.json @@ -522,9 +522,6 @@ "type": "string", "description": "If not connected to a network, the reason why." }, - "userUrl": { - "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/UserUrl" - }, "network": { "title": "network", "type": "object", diff --git a/api-specs/openrpc-dapp-remote-api.json b/api-specs/openrpc-dapp-remote-api.json index 2c5e8a169..447077fd2 100644 --- a/api-specs/openrpc-dapp-remote-api.json +++ b/api-specs/openrpc-dapp-remote-api.json @@ -23,7 +23,21 @@ "result": { "name": "result", "schema": { - "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/StatusEvent" + "title": "StatusEventAsync", + "allOf": [ + { + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/StatusEvent" + }, + { + "type": "object", + "properties": { + "userUrl": { + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/UserUrl" + } + }, + "required": ["userUrl"] + } + ] } }, "description": "Ensures ledger connectivity and returns the connected network information along with the user access token. NetworkId should follow CAIP-2 and represent the synchronizerId." diff --git a/core/wallet-dapp-remote-rpc-client/src/index.ts b/core/wallet-dapp-remote-rpc-client/src/index.ts index f91f2698f..44126bc47 100644 --- a/core/wallet-dapp-remote-rpc-client/src/index.ts +++ b/core/wallet-dapp-remote-rpc-client/src/index.ts @@ -194,6 +194,19 @@ export interface Session { userId: UserId [k: string]: any } +export interface StatusEvent { + kernel: KernelInfo + isConnected: IsConnected + isNetworkConnected: IsNetworkConnected + networkReason?: NetworkReason + network?: Network + session?: Session + [k: string]: any +} +export interface ObjectOfUserUrlMkZ1IR2Z { + userUrl: UserUrl + [k: string]: any +} export type Dar = string export type Dars = Dar[] /** @@ -432,16 +445,7 @@ export interface LedgerApiParams { body?: Body [k: string]: any } -export interface StatusEvent { - kernel: KernelInfo - isConnected: IsConnected - isNetworkConnected: IsNetworkConnected - networkReason?: NetworkReason - userUrl?: UserUrl - network?: Network - session?: Session - [k: string]: any -} +export type StatusEventAsync = StatusEvent & ObjectOfUserUrlMkZ1IR2Z /** * * Represents a null value, used in responses where no data is returned. @@ -495,7 +499,7 @@ export type TxChangedEvent = */ export type Status = () => Promise -export type Connect = () => Promise +export type Connect = () => Promise export type Disconnect = () => Promise export type DarsAvailable = () => Promise export type PrepareReturn = ( diff --git a/core/wallet-dapp-remote-rpc-client/src/openrpc.json b/core/wallet-dapp-remote-rpc-client/src/openrpc.json index 2c5e8a169..447077fd2 100644 --- a/core/wallet-dapp-remote-rpc-client/src/openrpc.json +++ b/core/wallet-dapp-remote-rpc-client/src/openrpc.json @@ -23,7 +23,21 @@ "result": { "name": "result", "schema": { - "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/StatusEvent" + "title": "StatusEventAsync", + "allOf": [ + { + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/StatusEvent" + }, + { + "type": "object", + "properties": { + "userUrl": { + "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/UserUrl" + } + }, + "required": ["userUrl"] + } + ] } }, "description": "Ensures ledger connectivity and returns the connected network information along with the user access token. NetworkId should follow CAIP-2 and represent the synchronizerId." diff --git a/core/wallet-dapp-rpc-client/src/index.ts b/core/wallet-dapp-rpc-client/src/index.ts index 285d7cfbb..5b119a859 100644 --- a/core/wallet-dapp-rpc-client/src/index.ts +++ b/core/wallet-dapp-rpc-client/src/index.ts @@ -437,7 +437,6 @@ export interface StatusEvent { isConnected: IsConnected isNetworkConnected: IsNetworkConnected networkReason?: NetworkReason - userUrl?: UserUrl network?: Network session?: Session [k: string]: any diff --git a/core/wallet-dapp-rpc-client/src/openrpc.json b/core/wallet-dapp-rpc-client/src/openrpc.json index 3d4d239f6..3b9d71e70 100644 --- a/core/wallet-dapp-rpc-client/src/openrpc.json +++ b/core/wallet-dapp-rpc-client/src/openrpc.json @@ -522,9 +522,6 @@ "type": "string", "description": "If not connected to a network, the reason why." }, - "userUrl": { - "$ref": "api-specs/openrpc-dapp-api.json#/components/schemas/UserUrl" - }, "network": { "title": "network", "type": "object", diff --git a/sdk/dapp-sdk/src/dapp-api/rpc-gen/typings.ts b/sdk/dapp-sdk/src/dapp-api/rpc-gen/typings.ts index 82ceeac7a..86309f37e 100644 --- a/sdk/dapp-sdk/src/dapp-api/rpc-gen/typings.ts +++ b/sdk/dapp-sdk/src/dapp-api/rpc-gen/typings.ts @@ -437,7 +437,6 @@ export interface StatusEvent { isConnected: IsConnected isNetworkConnected: IsNetworkConnected networkReason?: NetworkReason - userUrl?: UserUrl network?: Network session?: Session [k: string]: any diff --git a/wallet-gateway/extension/src/dapp-api/rpc-gen/typings.ts b/wallet-gateway/extension/src/dapp-api/rpc-gen/typings.ts index 82ceeac7a..86309f37e 100644 --- a/wallet-gateway/extension/src/dapp-api/rpc-gen/typings.ts +++ b/wallet-gateway/extension/src/dapp-api/rpc-gen/typings.ts @@ -437,7 +437,6 @@ export interface StatusEvent { isConnected: IsConnected isNetworkConnected: IsNetworkConnected networkReason?: NetworkReason - userUrl?: UserUrl network?: Network session?: Session [k: string]: any diff --git a/wallet-gateway/remote/src/dapp-api/controller.ts b/wallet-gateway/remote/src/dapp-api/controller.ts index 2c8b9ac8e..987a2611a 100644 --- a/wallet-gateway/remote/src/dapp-api/controller.ts +++ b/wallet-gateway/remote/src/dapp-api/controller.ts @@ -9,6 +9,7 @@ import { PrepareExecuteParams, PrepareReturnParams, StatusEvent, + StatusEventAsync, } from './rpc-gen/typings.js' import { Store } from '@canton-network/core-wallet-store' import { @@ -58,7 +59,6 @@ export const dappController = ( isConnected: true, isNetworkConnected: status.isConnected, networkReason: status.reason ? status.reason : 'OK', - userUrl: `${userUrl}/login/`, network: { networkId: network.id, ledgerApi: { @@ -69,7 +69,8 @@ export const dappController = ( accessToken: context.accessToken, userId: context.userId, }, - } + userUrl: `${userUrl}/login/`, + } as StatusEventAsync }, disconnect: async () => { if (!context) { diff --git a/wallet-gateway/remote/src/dapp-api/rpc-gen/typings.ts b/wallet-gateway/remote/src/dapp-api/rpc-gen/typings.ts index 3d3735dd2..56a838378 100644 --- a/wallet-gateway/remote/src/dapp-api/rpc-gen/typings.ts +++ b/wallet-gateway/remote/src/dapp-api/rpc-gen/typings.ts @@ -194,6 +194,19 @@ export interface Session { userId: UserId [k: string]: any } +export interface StatusEvent { + kernel: KernelInfo + isConnected: IsConnected + isNetworkConnected: IsNetworkConnected + networkReason?: NetworkReason + network?: Network + session?: Session + [k: string]: any +} +export interface ObjectOfUserUrlMkZ1IR2Z { + userUrl: UserUrl + [k: string]: any +} export type Dar = string export type Dars = Dar[] /** @@ -432,16 +445,7 @@ export interface LedgerApiParams { body?: Body [k: string]: any } -export interface StatusEvent { - kernel: KernelInfo - isConnected: IsConnected - isNetworkConnected: IsNetworkConnected - networkReason?: NetworkReason - userUrl?: UserUrl - network?: Network - session?: Session - [k: string]: any -} +export type StatusEventAsync = StatusEvent & ObjectOfUserUrlMkZ1IR2Z /** * * Represents a null value, used in responses where no data is returned. @@ -495,7 +499,7 @@ export type TxChangedEvent = */ export type Status = () => Promise -export type Connect = () => Promise +export type Connect = () => Promise export type Disconnect = () => Promise export type DarsAvailable = () => Promise export type PrepareReturn = ( diff --git a/wallet-gateway/remote/src/user-api/controller.ts b/wallet-gateway/remote/src/user-api/controller.ts index 9fc9e1c7e..e1994be7e 100644 --- a/wallet-gateway/remote/src/user-api/controller.ts +++ b/wallet-gateway/remote/src/user-api/controller.ts @@ -55,7 +55,6 @@ import { ledgerPrepareParams, } from '../utils.js' import { StatusEvent } from '../dapp-api/rpc-gen/typings.js' -import { user } from './server.js' type AvailableSigningDrivers = Partial< Record From c708122a35f2bb0a3461f79a9c23bb70cd923b03 Mon Sep 17 00:00:00 2001 From: Marc Juchli Date: Wed, 10 Dec 2025 18:18:07 +0100 Subject: [PATCH 3/4] Remove log Signed-off-by: Marc Juchli --- sdk/dapp-sdk/src/provider.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/dapp-sdk/src/provider.ts b/sdk/dapp-sdk/src/provider.ts index a709f5f6c..0471ac8a4 100644 --- a/sdk/dapp-sdk/src/provider.ts +++ b/sdk/dapp-sdk/src/provider.ts @@ -171,7 +171,6 @@ export const dappController = (provider: SpliceProvider) => provider.on( 'onConnected', (event) => { - console.log('SDK: onConnected event', event) clearTimeout(timeout) resolve(event) } From fe7ac285963965ddf06a5d9b2564c2f2ef778c46 Mon Sep 17 00:00:00 2001 From: Marc Juchli Date: Wed, 10 Dec 2025 18:27:09 +0100 Subject: [PATCH 4/4] add user url Signed-off-by: Marc Juchli --- sdk/dapp-sdk/src/provider/open.ts | 2 +- wallet-gateway/remote/src/dapp-api/controller.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sdk/dapp-sdk/src/provider/open.ts b/sdk/dapp-sdk/src/provider/open.ts index 7b049ac65..cf6f2b0c1 100644 --- a/sdk/dapp-sdk/src/provider/open.ts +++ b/sdk/dapp-sdk/src/provider/open.ts @@ -15,5 +15,5 @@ export async function open(): Promise { throw new Error('No previous session found') } - openKernelUserUI(discovery.walletType, session.kernel.userUrl ?? '') + openKernelUserUI(discovery.walletType, session.userUrl ?? '') } diff --git a/wallet-gateway/remote/src/dapp-api/controller.ts b/wallet-gateway/remote/src/dapp-api/controller.ts index 987a2611a..03eb6441b 100644 --- a/wallet-gateway/remote/src/dapp-api/controller.ts +++ b/wallet-gateway/remote/src/dapp-api/controller.ts @@ -235,7 +235,8 @@ export const dappController = ( accessToken: context.accessToken, userId: context.userId, }, - } + userUrl: `${userUrl}/login/`, + } as StatusEventAsync }, onConnected: async () => { throw new Error('Only for events.')