@canton-network/core-wallet-dapp-rpc-client 0.22.1 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +89 -91
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -12,8 +12,8 @@ var SpliceWalletJSONRPCDAppAPI = class {
|
|
|
12
12
|
__publicField(this, "transport");
|
|
13
13
|
this.transport = transport;
|
|
14
14
|
}
|
|
15
|
-
async request(
|
|
16
|
-
const response = await this.transport.submit(
|
|
15
|
+
async request(args) {
|
|
16
|
+
const response = await this.transport.submit(args);
|
|
17
17
|
if ("error" in response) {
|
|
18
18
|
throw new Error(
|
|
19
19
|
"RPC error: " + response.error.code + " - " + response.error.message
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;AA2fO,IAAM,6BAAN,MAAiC;AAAA,EAGpC,YAAY,SAAA,EAAyB;AAFrC,IAAA,aAAA,CAAA,IAAA,EAAO,WAAA,CAAA;AAGH,IAAA,IAAA,CAAK,SAAA,GAAY,SAAA;AAAA,EACrB;AAAA,EA8GA,MAAa,OAAA,CACT,MAAA,EACA,MAAA,EACgB;AAChB,IAAA,MAAM,QAAA,GAAW,MAAM,IAAA,CAAK,SAAA,CAAU,OAAO,EAAE,MAAA,EAAQ,QAAQ,CAAA;AAE/D,IAAA,IAAI,WAAW,QAAA,EAAU;AACrB,MAAA,MAAM,IAAI,KAAA;AAAA,QACN,gBACI,QAAA,CAAS,KAAA,CAAM,IAAA,GACf,KAAA,GACA,SAAS,KAAA,CAAM;AAAA,OACvB;AAAA,IACJ,CAAA,MAAO;AACH,MAAA,OAAO,QAAA,CAAS,MAAA;AAAA,IACpB;AAAA,EACJ;AACJ;AACA,IAAO,aAAA,GAAQ","file":"index.cjs","sourcesContent":["// Code generated by @open-rpc/generator DO NOT EDIT.\nimport _ from 'lodash'\n\nimport { RequestPayload } from '@canton-network/core-types'\nimport { RpcTransport } from '@canton-network/core-rpc-transport'\n\n/**\n *\n * The unique identifier of the command associated with the transaction.\n *\n */\nexport type CommandId = string\n/**\n *\n * Structure representing JS commands for transaction execution\n *\n */\nexport interface JsCommands {\n [key: string]: any\n}\n/**\n *\n * The party that signed the transaction.\n *\n */\nexport type Party = string\n/**\n *\n * Set of parties on whose behalf the command should be executed, if submitted. If not set, the primary wallet's party is used.\n *\n */\nexport type ActAs = Party[]\n/**\n *\n * Set of parties that should be granted read access to the command, if submitted. If not set, no additional read parties are granted.\n *\n */\nexport type ReadAs = Party[]\n/**\n *\n * The template identifier of the disclosed contract.\n *\n */\nexport type TemplateId = string\n/**\n *\n * The unique identifier of the disclosed contract.\n *\n */\nexport type ContractId = string\n/**\n *\n * The blob data of the created event for the disclosed contract.\n *\n */\nexport type CreatedEventBlob = string\n/**\n *\n * If not set, a suitable synchronizer that this node is connected to will be chosen.\n *\n */\nexport type SynchronizerId = string\n/**\n *\n * Structure representing a disclosed contract for transaction execution\n *\n */\nexport interface DisclosedContract {\n templateId?: TemplateId\n contractId?: ContractId\n createdEventBlob: CreatedEventBlob\n synchronizerId?: SynchronizerId\n [k: string]: any\n}\n/**\n *\n * List of contract IDs to be disclosed with the command.\n *\n */\nexport type DisclosedContracts = DisclosedContract[]\nexport type PackageId = string\n/**\n *\n * The package-id selection preference of the client for resolving package names and interface instances in command submission and interpretation\n *\n */\nexport type PackageIdSelectionPreference = PackageId[]\n/**\n *\n * The message to sign.\n *\n */\nexport type Message = string\nexport type RequestMethod = 'GET' | 'POST' | 'PUT' | 'DELETE'\nexport type Resource = string\nexport type Body = string\n/**\n *\n * The unique identifier of the Wallet Gateway.\n *\n */\nexport type Id = string\n/**\n *\n * The type of client that implements the Wallet Gateway.\n *\n */\nexport type ClientType = 'browser' | 'desktop' | 'mobile' | 'remote'\n/**\n *\n * The URL of the Wallet Gateway.\n *\n */\nexport type Url = string\n/**\n *\n * A URL that points to a user interface.\n *\n */\nexport type UserUrl = string\n/**\n *\n * Represents a Wallet Gateway.\n *\n */\nexport interface KernelInfo {\n id: Id\n clientType: ClientType\n url?: Url\n userUrl?: UserUrl\n [k: string]: any\n}\n/**\n *\n * Whether or not the user is authenticated with the Wallet.\n *\n */\nexport type IsConnected = boolean\n/**\n *\n * Whether or not a connection to a network is established.\n *\n */\nexport type IsNetworkConnected = boolean\n/**\n *\n * If not connected to a network, the reason why.\n *\n */\nexport type NetworkReason = string\n/**\n *\n * The network ID the wallet corresponds to.\n *\n */\nexport type NetworkId = string\n/**\n *\n * The base URL of the ledger API.\n *\n */\nexport type BaseUrl = string\n/**\n *\n * Ledger API configuration.\n *\n */\nexport interface LedgerApiConfig {\n baseUrl: BaseUrl\n [k: string]: any\n}\n/**\n *\n * Network information, if connected to a network.\n *\n */\nexport interface Network {\n networkId: NetworkId\n ledgerApi?: LedgerApiConfig\n [k: string]: any\n}\n/**\n *\n * JWT authentication token.\n *\n */\nexport type AccessToken = string\n/**\n *\n * The user identifier.\n *\n */\nexport type UserId = string\n/**\n *\n * Session information, if authenticated.\n *\n */\nexport interface Session {\n accessToken: AccessToken\n userId: UserId\n [k: string]: any\n}\n/**\n *\n * The status of the transaction.\n *\n */\nexport type StatusExecuted = 'executed'\n/**\n *\n * The update ID corresponding to the transaction.\n *\n */\nexport type UpdateId = string\nexport type CompletionOffset = number\n/**\n *\n * Payload for the TxChangedExecutedEvent.\n *\n */\nexport interface TxChangedExecutedPayload {\n updateId: UpdateId\n completionOffset: CompletionOffset\n}\n/**\n *\n * Event emitted when a transaction is executed against the participant.\n *\n */\nexport interface TxChangedExecutedEvent {\n status: StatusExecuted\n commandId: CommandId\n payload: TxChangedExecutedPayload\n}\n/**\n *\n * The signature of the transaction.\n *\n */\nexport type Signature = string\nexport type Response = string\n/**\n *\n * Set as primary wallet for dApp usage.\n *\n */\nexport type Primary = boolean\n/**\n *\n * The party ID corresponding to the wallet.\n *\n */\nexport type PartyId = string\n/**\n *\n * The status of the wallet.\n *\n */\nexport type WalletStatus = 'initialized' | 'allocated'\n/**\n *\n * The party hint and name of the wallet.\n *\n */\nexport type Hint = string\n/**\n *\n * The public key of the party.\n *\n */\nexport type PublicKey = string\n/**\n *\n * The namespace of the party.\n *\n */\nexport type Namespace = string\n/**\n *\n * The signing provider ID the wallet corresponds to.\n *\n */\nexport type SigningProviderId = string\n/**\n *\n * Unique identifier of the signed transaction given by the Signing Provider. This may not be the same as the internal txId given by the Wallet Gateway.\n *\n */\nexport type ExternalTxId = string\n/**\n *\n * The topology transactions\n *\n */\nexport type TopologyTransactions = string\n/**\n *\n * Whether the wallet is disabled. Wallets are disabled when no signing provider matches the party's namespace during sync. Disabled wallets use participant as the default signing provider.\n *\n */\nexport type Disabled = boolean\n/**\n *\n * Reason for the wallet state, e.g., 'no signing provider matched'.\n *\n */\nexport type Reason = string\n/**\n *\n * Structure representing a wallet\n *\n */\nexport interface Wallet {\n primary: Primary\n partyId: PartyId\n status: WalletStatus\n hint: Hint\n publicKey: PublicKey\n namespace: Namespace\n networkId: NetworkId\n signingProviderId: SigningProviderId\n externalTxId?: ExternalTxId\n topologyTransactions?: TopologyTransactions\n disabled?: Disabled\n reason?: Reason\n [k: string]: any\n}\n/**\n *\n * The status of the transaction.\n *\n */\nexport type StatusPending = 'pending'\n/**\n *\n * Event emitted when a transaction is pending.\n *\n */\nexport interface TxChangedPendingEvent {\n status: StatusPending\n commandId: CommandId\n}\n/**\n *\n * The status of the transaction.\n *\n */\nexport type StatusSigned = 'signed'\n/**\n *\n * The identifier of the provider that signed the transaction.\n *\n */\nexport type SignedBy = string\n/**\n *\n * Payload for the TxChangedSignedEvent.\n *\n */\nexport interface TxChangedSignedPayload {\n signature: Signature\n signedBy: SignedBy\n party: Party\n}\n/**\n *\n * Event emitted when a transaction has been signed.\n *\n */\nexport interface TxChangedSignedEvent {\n status: StatusSigned\n commandId: CommandId\n payload: TxChangedSignedPayload\n}\n/**\n *\n * The status of the transaction.\n *\n */\nexport type StatusFailed = 'failed'\n/**\n *\n * Event emitted when a transaction has failed.\n *\n */\nexport interface TxChangedFailedEvent {\n status: StatusFailed\n commandId: CommandId\n}\n/**\n *\n * Structure representing the request for prepare and execute calls\n *\n */\nexport interface PrepareExecuteParams {\n commandId?: CommandId\n commands: JsCommands\n actAs?: ActAs\n readAs?: ReadAs\n disclosedContracts?: DisclosedContracts\n synchronizerId?: SynchronizerId\n packageIdSelectionPreference?: PackageIdSelectionPreference\n [k: string]: any\n}\n/**\n *\n * Request to sign a message.\n *\n */\nexport interface SignMessageParams {\n message: Message\n [k: string]: any\n}\n/**\n *\n * Ledger API request structure\n *\n */\nexport interface LedgerApiParams {\n requestMethod: RequestMethod\n resource: Resource\n body?: Body\n [k: string]: any\n}\nexport interface StatusEvent {\n kernel: KernelInfo\n isConnected: IsConnected\n isNetworkConnected: IsNetworkConnected\n networkReason?: NetworkReason\n network?: Network\n session?: Session\n [k: string]: any\n}\n/**\n *\n * Represents a null value, used in responses where no data is returned.\n *\n */\nexport type Null = null\nexport interface PrepareExecuteAndWaitResult {\n tx: TxChangedExecutedEvent\n [k: string]: any\n}\n/**\n *\n * Result of signing a message.\n *\n */\nexport interface SignMessageResult {\n signature: Signature\n [k: string]: any\n}\n/**\n *\n * Ledger Api configuration options\n *\n */\nexport interface LedgerApiResult {\n response: Response\n [k: string]: any\n}\n/**\n *\n * Event emitted when the user's accounts change.\n *\n */\nexport type AccountsChangedEvent = Wallet[]\n/**\n *\n * An array of accounts that the user has authorized the dapp to access..\n *\n */\nexport type ListAccountsResult = Wallet[]\n/**\n *\n * Event emitted when a transaction changes.\n *\n */\nexport type TxChangedEvent =\n | TxChangedPendingEvent\n | TxChangedSignedEvent\n | TxChangedExecutedEvent\n | TxChangedFailedEvent\n/**\n *\n * Generated! Represents an alias to any of the provided schemas\n *\n */\n\nexport type Status = () => Promise<StatusEvent>\nexport type Connect = () => Promise<StatusEvent>\nexport type Disconnect = () => Promise<Null>\nexport type GetActiveNetwork = () => Promise<Network>\nexport type PrepareExecute = (params: PrepareExecuteParams) => Promise<Null>\nexport type PrepareExecuteAndWait = (\n params: PrepareExecuteParams\n) => Promise<PrepareExecuteAndWaitResult>\nexport type SignMessage = (\n params: SignMessageParams\n) => Promise<SignMessageResult>\nexport type LedgerApi = (params: LedgerApiParams) => Promise<LedgerApiResult>\nexport type AccountsChanged = () => Promise<AccountsChangedEvent>\nexport type GetPrimaryAccount = () => Promise<Wallet>\nexport type ListAccounts = () => Promise<ListAccountsResult>\nexport type TxChanged = () => Promise<TxChangedEvent>\n\nexport class SpliceWalletJSONRPCDAppAPI {\n public transport: RpcTransport\n\n constructor(transport: RpcTransport) {\n this.transport = transport\n }\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'status',\n ...params: Parameters<Status>\n ): ReturnType<Status>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'connect',\n ...params: Parameters<Connect>\n ): ReturnType<Connect>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'disconnect',\n ...params: Parameters<Disconnect>\n ): ReturnType<Disconnect>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'getActiveNetwork',\n ...params: Parameters<GetActiveNetwork>\n ): ReturnType<GetActiveNetwork>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'prepareExecute',\n ...params: Parameters<PrepareExecute>\n ): ReturnType<PrepareExecute>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'prepareExecuteAndWait',\n ...params: Parameters<PrepareExecuteAndWait>\n ): ReturnType<PrepareExecuteAndWait>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'signMessage',\n ...params: Parameters<SignMessage>\n ): ReturnType<SignMessage>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'ledgerApi',\n ...params: Parameters<LedgerApi>\n ): ReturnType<LedgerApi>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'accountsChanged',\n ...params: Parameters<AccountsChanged>\n ): ReturnType<AccountsChanged>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'getPrimaryAccount',\n ...params: Parameters<GetPrimaryAccount>\n ): ReturnType<GetPrimaryAccount>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'listAccounts',\n ...params: Parameters<ListAccounts>\n ): ReturnType<ListAccounts>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'txChanged',\n ...params: Parameters<TxChanged>\n ): ReturnType<TxChanged>\n\n public async request(\n method: string,\n params?: RequestPayload['params']\n ): Promise<unknown> {\n const response = await this.transport.submit({ method, params })\n\n if ('error' in response) {\n throw new Error(\n 'RPC error: ' +\n response.error.code +\n ' - ' +\n response.error.message\n )\n } else {\n return response.result\n }\n }\n}\nexport default SpliceWalletJSONRPCDAppAPI\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;AA2jBO,IAAM,6BAAN,MAAiC;AAAA,EAGpC,YAAY,SAAA,EAAyB;AAFrC,IAAA,aAAA,CAAA,IAAA,EAAO,WAAA,CAAA;AAGH,IAAA,IAAA,CAAK,SAAA,GAAY,SAAA;AAAA,EACrB;AAAA,EAEA,MAAa,QACT,IAAA,EAC8B;AAC9B,IAAA,MAAM,QAAA,GAAW,MAAM,IAAA,CAAK,SAAA,CAAU,OAAO,IAAsB,CAAA;AAEnE,IAAA,IAAI,WAAW,QAAA,EAAU;AACrB,MAAA,MAAM,IAAI,KAAA;AAAA,QACN,gBACI,QAAA,CAAS,KAAA,CAAM,IAAA,GACf,KAAA,GACA,SAAS,KAAA,CAAM;AAAA,OACvB;AAAA,IACJ,CAAA,MAAO;AACH,MAAA,OAAO,QAAA,CAAS,MAAA;AAAA,IACpB;AAAA,EACJ;AACJ;AACA,IAAO,aAAA,GAAQ","file":"index.cjs","sourcesContent":["// Code generated by @open-rpc/generator DO NOT EDIT.\nimport _ from 'lodash'\n\nimport { RequestArgs, RequestPayload } from '@canton-network/core-types'\nimport { RpcTransport } from '@canton-network/core-rpc-transport'\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n/**\n *\n * The unique identifier of the command associated with the transaction.\n *\n */\nexport type CommandId = string\ntype AlwaysTrue = any\n/**\n *\n * Structure representing JS commands for transaction execution\n *\n */\nexport interface JsCommands {\n [key: string]: any\n}\n/**\n *\n * The party that signed the transaction.\n *\n */\nexport type Party = string\n/**\n *\n * Set of parties on whose behalf the command should be executed, if submitted. If not set, the primary wallet's party is used.\n *\n */\nexport type ActAs = Party[]\n/**\n *\n * Set of parties that should be granted read access to the command, if submitted. If not set, no additional read parties are granted.\n *\n */\nexport type ReadAs = Party[]\n/**\n *\n * The template identifier of the disclosed contract.\n *\n */\nexport type TemplateId = string\n/**\n *\n * The unique identifier of the disclosed contract.\n *\n */\nexport type ContractId = string\n/**\n *\n * The blob data of the created event for the disclosed contract.\n *\n */\nexport type CreatedEventBlob = string\n/**\n *\n * If not set, a suitable synchronizer that this node is connected to will be chosen.\n *\n */\nexport type SynchronizerId = string\n/**\n *\n * Structure representing a disclosed contract for transaction execution\n *\n */\nexport interface DisclosedContract {\n templateId?: TemplateId\n contractId?: ContractId\n createdEventBlob: CreatedEventBlob\n synchronizerId?: SynchronizerId\n}\n/**\n *\n * List of contract IDs to be disclosed with the command.\n *\n */\nexport type DisclosedContracts = DisclosedContract[]\nexport type PackageId = string\n/**\n *\n * The package-id selection preference of the client for resolving package names and interface instances in command submission and interpretation\n *\n */\nexport type PackageIdSelectionPreference = PackageId[]\n/**\n *\n * The message to sign.\n *\n */\nexport type Message = string\nexport type RequestMethod = 'GET' | 'POST' | 'PUT' | 'DELETE'\nexport type Resource = string\nexport type Body = string\n/**\n *\n * The unique identifier of the Provider.\n *\n */\nexport type Id = string\n/**\n *\n * The version of the Provider.\n *\n */\nexport type Version = string\n/**\n *\n * The type of client that implements the Provider.\n *\n */\nexport type ProviderType = 'browser' | 'desktop' | 'mobile' | 'remote'\n/**\n *\n * The URL of the Wallet Provider.\n *\n */\nexport type Url = string\n/**\n *\n * A URL that points to a user interface.\n *\n */\nexport type UserUrl = string\n/**\n *\n * Represents a Provider.\n *\n */\nexport interface Provider {\n id: Id\n version?: Version\n providerType?: ProviderType\n url?: Url\n userUrl?: UserUrl\n}\n/**\n *\n * Whether or not the user is authenticated with the Wallet.\n *\n */\nexport type IsConnected = boolean\n/**\n *\n * Reason for the wallet state, e.g., 'no signing provider matched'.\n *\n */\nexport type Reason = string\n/**\n *\n * Whether or not a connection to a network is established.\n *\n */\nexport type IsNetworkConnected = boolean\n/**\n *\n * If not connected to a network, the reason why.\n *\n */\nexport type NetworkReason = string\nexport interface ConnectResult {\n isConnected: IsConnected\n reason?: Reason\n isNetworkConnected: IsNetworkConnected\n networkReason?: NetworkReason\n userUrl?: UserUrl\n}\n/**\n *\n * The network ID the wallet corresponds to.\n *\n */\nexport type NetworkId = string\n/**\n *\n * The base URL of the ledger API.\n *\n */\nexport type LedgerApiUrl = string\n/**\n *\n * JWT authentication token.\n *\n */\nexport type AccessToken = string\n/**\n *\n * Network information, if connected to a network.\n *\n */\nexport interface Network {\n networkId: NetworkId\n ledgerApi?: LedgerApiUrl\n accessToken?: AccessToken\n}\n/**\n *\n * The user identifier.\n *\n */\nexport type UserId = string\n/**\n *\n * Session information, if authenticated.\n *\n */\nexport interface Session {\n accessToken: AccessToken\n userId: UserId\n}\n/**\n *\n * The status of the transaction.\n *\n */\nexport type StatusExecuted = 'executed'\n/**\n *\n * The update ID corresponding to the transaction.\n *\n */\nexport type UpdateId = string\nexport type CompletionOffset = number\n/**\n *\n * Payload for the TxChangedExecutedEvent.\n *\n */\nexport interface TxChangedExecutedPayload {\n updateId: UpdateId\n completionOffset: CompletionOffset\n}\n/**\n *\n * Event emitted when a transaction is executed against the participant.\n *\n */\nexport interface TxChangedExecutedEvent {\n status: StatusExecuted\n commandId: CommandId\n payload: TxChangedExecutedPayload\n}\n/**\n *\n * The signature of the transaction.\n *\n */\nexport type Signature = string\nexport type Response = string\n/**\n *\n * Set as primary wallet for dApp usage.\n *\n */\nexport type Primary = boolean\n/**\n *\n * The party ID corresponding to the wallet.\n *\n */\nexport type PartyId = string\n/**\n *\n * The status of the wallet.\n *\n */\nexport type WalletStatus = 'initialized' | 'allocated'\n/**\n *\n * The party hint and name of the wallet.\n *\n */\nexport type Hint = string\n/**\n *\n * The public key of the party.\n *\n */\nexport type PublicKey = string\n/**\n *\n * The namespace of the party.\n *\n */\nexport type Namespace = string\n/**\n *\n * The signing provider ID the wallet corresponds to.\n *\n */\nexport type SigningProviderId = string\n/**\n *\n * Unique identifier of the signed transaction given by the Signing Provider. This may not be the same as the internal txId given by the Wallet Gateway.\n *\n */\nexport type ExternalTxId = string\n/**\n *\n * The topology transactions\n *\n */\nexport type TopologyTransactions = string\n/**\n *\n * Whether the wallet is disabled. Wallets are disabled when no signing provider matches the party's namespace during sync. Disabled wallets use participant as the default signing provider.\n *\n */\nexport type Disabled = boolean\n/**\n *\n * Structure representing a wallet\n *\n */\nexport interface Wallet {\n primary: Primary\n partyId: PartyId\n status: WalletStatus\n hint: Hint\n publicKey: PublicKey\n namespace: Namespace\n networkId: NetworkId\n signingProviderId: SigningProviderId\n externalTxId?: ExternalTxId\n topologyTransactions?: TopologyTransactions\n disabled?: Disabled\n reason?: Reason\n}\n/**\n *\n * The status of the transaction.\n *\n */\nexport type StatusPending = 'pending'\n/**\n *\n * Event emitted when a transaction is pending.\n *\n */\nexport interface TxChangedPendingEvent {\n status: StatusPending\n commandId: CommandId\n}\n/**\n *\n * The status of the transaction.\n *\n */\nexport type StatusSigned = 'signed'\n/**\n *\n * The identifier of the provider that signed the transaction.\n *\n */\nexport type SignedBy = string\n/**\n *\n * Payload for the TxChangedSignedEvent.\n *\n */\nexport interface TxChangedSignedPayload {\n signature: Signature\n signedBy: SignedBy\n party: Party\n}\n/**\n *\n * Event emitted when a transaction has been signed.\n *\n */\nexport interface TxChangedSignedEvent {\n status: StatusSigned\n commandId: CommandId\n payload: TxChangedSignedPayload\n}\n/**\n *\n * The status of the transaction.\n *\n */\nexport type StatusFailed = 'failed'\n/**\n *\n * Event emitted when a transaction has failed.\n *\n */\nexport interface TxChangedFailedEvent {\n status: StatusFailed\n commandId: CommandId\n}\n/**\n *\n * Structure representing the request for prepare and execute calls\n *\n */\nexport interface PrepareExecuteParams {\n commandId?: CommandId\n commands: JsCommands\n actAs?: ActAs\n readAs?: ReadAs\n disclosedContracts?: DisclosedContracts\n synchronizerId?: SynchronizerId\n packageIdSelectionPreference?: PackageIdSelectionPreference\n}\n/**\n *\n * Request to sign a message.\n *\n */\nexport interface SignMessageParams {\n message: Message\n}\n/**\n *\n * Ledger API request structure\n *\n */\nexport interface LedgerApiParams {\n requestMethod: RequestMethod\n resource: Resource\n body?: Body\n}\nexport interface StatusEvent {\n provider: Provider\n connection: ConnectResult\n network?: Network\n session?: Session\n}\n/**\n *\n * Represents a null value, used in responses where no data is returned.\n *\n */\nexport type Null = null\nexport interface PrepareExecuteAndWaitResult {\n tx: TxChangedExecutedEvent\n}\n/**\n *\n * Result of signing a message.\n *\n */\nexport interface SignMessageResult {\n signature: Signature\n}\n/**\n *\n * Ledger Api configuration options\n *\n */\nexport interface LedgerApiResult {\n response: Response\n}\n/**\n *\n * Event emitted when the user's accounts change.\n *\n */\nexport type AccountsChangedEvent = Wallet[]\n/**\n *\n * An array of accounts that the user has authorized the dapp to access..\n *\n */\nexport type ListAccountsResult = Wallet[]\n/**\n *\n * Event emitted when a transaction changes.\n *\n */\nexport type TxChangedEvent =\n | TxChangedPendingEvent\n | TxChangedSignedEvent\n | TxChangedExecutedEvent\n | TxChangedFailedEvent\n/**\n *\n * Generated! Represents an alias to any of the provided schemas\n *\n */\n\nexport type Status = () => Promise<StatusEvent>\nexport type Connect = () => Promise<ConnectResult>\nexport type Disconnect = () => Promise<Null>\nexport type GetActiveNetwork = () => Promise<Network>\nexport type PrepareExecute = (params: PrepareExecuteParams) => Promise<Null>\nexport type PrepareExecuteAndWait = (\n params: PrepareExecuteParams\n) => Promise<PrepareExecuteAndWaitResult>\nexport type SignMessage = (\n params: SignMessageParams\n) => Promise<SignMessageResult>\nexport type LedgerApi = (params: LedgerApiParams) => Promise<LedgerApiResult>\nexport type AccountsChanged = () => Promise<AccountsChangedEvent>\nexport type GetPrimaryAccount = () => Promise<Wallet>\nexport type ListAccounts = () => Promise<ListAccountsResult>\nexport type TxChanged = () => Promise<TxChangedEvent>\n/* eslint-enable @typescript-eslint/no-unused-vars */\n\ntype Params<T> = T extends (...args: infer A) => any\n ? A extends []\n ? never\n : A[0]\n : never\ntype Result<T> = T extends (...args: any[]) => Promise<infer R> ? R : never\n\nexport type RpcTypes = {\n status: {\n params: Params<Status>\n result: Result<Status>\n }\n\n connect: {\n params: Params<Connect>\n result: Result<Connect>\n }\n\n disconnect: {\n params: Params<Disconnect>\n result: Result<Disconnect>\n }\n\n getActiveNetwork: {\n params: Params<GetActiveNetwork>\n result: Result<GetActiveNetwork>\n }\n\n prepareExecute: {\n params: Params<PrepareExecute>\n result: Result<PrepareExecute>\n }\n\n prepareExecuteAndWait: {\n params: Params<PrepareExecuteAndWait>\n result: Result<PrepareExecuteAndWait>\n }\n\n signMessage: {\n params: Params<SignMessage>\n result: Result<SignMessage>\n }\n\n ledgerApi: {\n params: Params<LedgerApi>\n result: Result<LedgerApi>\n }\n\n accountsChanged: {\n params: Params<AccountsChanged>\n result: Result<AccountsChanged>\n }\n\n getPrimaryAccount: {\n params: Params<GetPrimaryAccount>\n result: Result<GetPrimaryAccount>\n }\n\n listAccounts: {\n params: Params<ListAccounts>\n result: Result<ListAccounts>\n }\n\n txChanged: {\n params: Params<TxChanged>\n result: Result<TxChanged>\n }\n}\n\nexport class SpliceWalletJSONRPCDAppAPI {\n public transport: RpcTransport\n\n constructor(transport: RpcTransport) {\n this.transport = transport\n }\n\n public async request<M extends keyof RpcTypes>(\n args: RequestArgs<RpcTypes, M>\n ): Promise<RpcTypes[M]['result']> {\n const response = await this.transport.submit(args as RequestPayload)\n\n if ('error' in response) {\n throw new Error(\n 'RPC error: ' +\n response.error.code +\n ' - ' +\n response.error.message\n )\n } else {\n return response.result as RpcTypes[M]['result']\n }\n }\n}\nexport default SpliceWalletJSONRPCDAppAPI\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { RequestArgs } from '@canton-network/core-types';
|
|
1
2
|
import { RpcTransport } from '@canton-network/core-rpc-transport';
|
|
2
3
|
/**
|
|
3
4
|
*
|
|
@@ -65,7 +66,6 @@ export interface DisclosedContract {
|
|
|
65
66
|
contractId?: ContractId;
|
|
66
67
|
createdEventBlob: CreatedEventBlob;
|
|
67
68
|
synchronizerId?: SynchronizerId;
|
|
68
|
-
[k: string]: any;
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
71
71
|
*
|
|
@@ -91,19 +91,25 @@ export type Resource = string;
|
|
|
91
91
|
export type Body = string;
|
|
92
92
|
/**
|
|
93
93
|
*
|
|
94
|
-
* The unique identifier of the
|
|
94
|
+
* The unique identifier of the Provider.
|
|
95
95
|
*
|
|
96
96
|
*/
|
|
97
97
|
export type Id = string;
|
|
98
98
|
/**
|
|
99
99
|
*
|
|
100
|
-
* The
|
|
100
|
+
* The version of the Provider.
|
|
101
101
|
*
|
|
102
102
|
*/
|
|
103
|
-
export type
|
|
103
|
+
export type Version = string;
|
|
104
104
|
/**
|
|
105
105
|
*
|
|
106
|
-
* The
|
|
106
|
+
* The type of client that implements the Provider.
|
|
107
|
+
*
|
|
108
|
+
*/
|
|
109
|
+
export type ProviderType = 'browser' | 'desktop' | 'mobile' | 'remote';
|
|
110
|
+
/**
|
|
111
|
+
*
|
|
112
|
+
* The URL of the Wallet Provider.
|
|
107
113
|
*
|
|
108
114
|
*/
|
|
109
115
|
export type Url = string;
|
|
@@ -115,15 +121,15 @@ export type Url = string;
|
|
|
115
121
|
export type UserUrl = string;
|
|
116
122
|
/**
|
|
117
123
|
*
|
|
118
|
-
* Represents a
|
|
124
|
+
* Represents a Provider.
|
|
119
125
|
*
|
|
120
126
|
*/
|
|
121
|
-
export interface
|
|
127
|
+
export interface Provider {
|
|
122
128
|
id: Id;
|
|
123
|
-
|
|
129
|
+
version?: Version;
|
|
130
|
+
providerType?: ProviderType;
|
|
124
131
|
url?: Url;
|
|
125
132
|
userUrl?: UserUrl;
|
|
126
|
-
[k: string]: any;
|
|
127
133
|
}
|
|
128
134
|
/**
|
|
129
135
|
*
|
|
@@ -131,6 +137,12 @@ export interface KernelInfo {
|
|
|
131
137
|
*
|
|
132
138
|
*/
|
|
133
139
|
export type IsConnected = boolean;
|
|
140
|
+
/**
|
|
141
|
+
*
|
|
142
|
+
* Reason for the wallet state, e.g., 'no signing provider matched'.
|
|
143
|
+
*
|
|
144
|
+
*/
|
|
145
|
+
export type Reason = string;
|
|
134
146
|
/**
|
|
135
147
|
*
|
|
136
148
|
* Whether or not a connection to a network is established.
|
|
@@ -143,6 +155,13 @@ export type IsNetworkConnected = boolean;
|
|
|
143
155
|
*
|
|
144
156
|
*/
|
|
145
157
|
export type NetworkReason = string;
|
|
158
|
+
export interface ConnectResult {
|
|
159
|
+
isConnected: IsConnected;
|
|
160
|
+
reason?: Reason;
|
|
161
|
+
isNetworkConnected: IsNetworkConnected;
|
|
162
|
+
networkReason?: NetworkReason;
|
|
163
|
+
userUrl?: UserUrl;
|
|
164
|
+
}
|
|
146
165
|
/**
|
|
147
166
|
*
|
|
148
167
|
* The network ID the wallet corresponds to.
|
|
@@ -154,16 +173,13 @@ export type NetworkId = string;
|
|
|
154
173
|
* The base URL of the ledger API.
|
|
155
174
|
*
|
|
156
175
|
*/
|
|
157
|
-
export type
|
|
176
|
+
export type LedgerApiUrl = string;
|
|
158
177
|
/**
|
|
159
178
|
*
|
|
160
|
-
*
|
|
179
|
+
* JWT authentication token.
|
|
161
180
|
*
|
|
162
181
|
*/
|
|
163
|
-
export
|
|
164
|
-
baseUrl: BaseUrl;
|
|
165
|
-
[k: string]: any;
|
|
166
|
-
}
|
|
182
|
+
export type AccessToken = string;
|
|
167
183
|
/**
|
|
168
184
|
*
|
|
169
185
|
* Network information, if connected to a network.
|
|
@@ -171,15 +187,9 @@ export interface LedgerApiConfig {
|
|
|
171
187
|
*/
|
|
172
188
|
export interface Network {
|
|
173
189
|
networkId: NetworkId;
|
|
174
|
-
ledgerApi?:
|
|
175
|
-
|
|
190
|
+
ledgerApi?: LedgerApiUrl;
|
|
191
|
+
accessToken?: AccessToken;
|
|
176
192
|
}
|
|
177
|
-
/**
|
|
178
|
-
*
|
|
179
|
-
* JWT authentication token.
|
|
180
|
-
*
|
|
181
|
-
*/
|
|
182
|
-
export type AccessToken = string;
|
|
183
193
|
/**
|
|
184
194
|
*
|
|
185
195
|
* The user identifier.
|
|
@@ -194,7 +204,6 @@ export type UserId = string;
|
|
|
194
204
|
export interface Session {
|
|
195
205
|
accessToken: AccessToken;
|
|
196
206
|
userId: UserId;
|
|
197
|
-
[k: string]: any;
|
|
198
207
|
}
|
|
199
208
|
/**
|
|
200
209
|
*
|
|
@@ -295,12 +304,6 @@ export type TopologyTransactions = string;
|
|
|
295
304
|
*
|
|
296
305
|
*/
|
|
297
306
|
export type Disabled = boolean;
|
|
298
|
-
/**
|
|
299
|
-
*
|
|
300
|
-
* Reason for the wallet state, e.g., 'no signing provider matched'.
|
|
301
|
-
*
|
|
302
|
-
*/
|
|
303
|
-
export type Reason = string;
|
|
304
307
|
/**
|
|
305
308
|
*
|
|
306
309
|
* Structure representing a wallet
|
|
@@ -319,7 +322,6 @@ export interface Wallet {
|
|
|
319
322
|
topologyTransactions?: TopologyTransactions;
|
|
320
323
|
disabled?: Disabled;
|
|
321
324
|
reason?: Reason;
|
|
322
|
-
[k: string]: any;
|
|
323
325
|
}
|
|
324
326
|
/**
|
|
325
327
|
*
|
|
@@ -396,7 +398,6 @@ export interface PrepareExecuteParams {
|
|
|
396
398
|
disclosedContracts?: DisclosedContracts;
|
|
397
399
|
synchronizerId?: SynchronizerId;
|
|
398
400
|
packageIdSelectionPreference?: PackageIdSelectionPreference;
|
|
399
|
-
[k: string]: any;
|
|
400
401
|
}
|
|
401
402
|
/**
|
|
402
403
|
*
|
|
@@ -405,7 +406,6 @@ export interface PrepareExecuteParams {
|
|
|
405
406
|
*/
|
|
406
407
|
export interface SignMessageParams {
|
|
407
408
|
message: Message;
|
|
408
|
-
[k: string]: any;
|
|
409
409
|
}
|
|
410
410
|
/**
|
|
411
411
|
*
|
|
@@ -416,16 +416,12 @@ export interface LedgerApiParams {
|
|
|
416
416
|
requestMethod: RequestMethod;
|
|
417
417
|
resource: Resource;
|
|
418
418
|
body?: Body;
|
|
419
|
-
[k: string]: any;
|
|
420
419
|
}
|
|
421
420
|
export interface StatusEvent {
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
isNetworkConnected: IsNetworkConnected;
|
|
425
|
-
networkReason?: NetworkReason;
|
|
421
|
+
provider: Provider;
|
|
422
|
+
connection: ConnectResult;
|
|
426
423
|
network?: Network;
|
|
427
424
|
session?: Session;
|
|
428
|
-
[k: string]: any;
|
|
429
425
|
}
|
|
430
426
|
/**
|
|
431
427
|
*
|
|
@@ -435,7 +431,6 @@ export interface StatusEvent {
|
|
|
435
431
|
export type Null = null;
|
|
436
432
|
export interface PrepareExecuteAndWaitResult {
|
|
437
433
|
tx: TxChangedExecutedEvent;
|
|
438
|
-
[k: string]: any;
|
|
439
434
|
}
|
|
440
435
|
/**
|
|
441
436
|
*
|
|
@@ -444,7 +439,6 @@ export interface PrepareExecuteAndWaitResult {
|
|
|
444
439
|
*/
|
|
445
440
|
export interface SignMessageResult {
|
|
446
441
|
signature: Signature;
|
|
447
|
-
[k: string]: any;
|
|
448
442
|
}
|
|
449
443
|
/**
|
|
450
444
|
*
|
|
@@ -453,7 +447,6 @@ export interface SignMessageResult {
|
|
|
453
447
|
*/
|
|
454
448
|
export interface LedgerApiResult {
|
|
455
449
|
response: Response;
|
|
456
|
-
[k: string]: any;
|
|
457
450
|
}
|
|
458
451
|
/**
|
|
459
452
|
*
|
|
@@ -479,7 +472,7 @@ export type TxChangedEvent = TxChangedPendingEvent | TxChangedSignedEvent | TxCh
|
|
|
479
472
|
*
|
|
480
473
|
*/
|
|
481
474
|
export type Status = () => Promise<StatusEvent>;
|
|
482
|
-
export type Connect = () => Promise<
|
|
475
|
+
export type Connect = () => Promise<ConnectResult>;
|
|
483
476
|
export type Disconnect = () => Promise<Null>;
|
|
484
477
|
export type GetActiveNetwork = () => Promise<Network>;
|
|
485
478
|
export type PrepareExecute = (params: PrepareExecuteParams) => Promise<Null>;
|
|
@@ -490,57 +483,62 @@ export type AccountsChanged = () => Promise<AccountsChangedEvent>;
|
|
|
490
483
|
export type GetPrimaryAccount = () => Promise<Wallet>;
|
|
491
484
|
export type ListAccounts = () => Promise<ListAccountsResult>;
|
|
492
485
|
export type TxChanged = () => Promise<TxChangedEvent>;
|
|
486
|
+
type Params<T> = T extends (...args: infer A) => any ? A extends [] ? never : A[0] : never;
|
|
487
|
+
type Result<T> = T extends (...args: any[]) => Promise<infer R> ? R : never;
|
|
488
|
+
export type RpcTypes = {
|
|
489
|
+
status: {
|
|
490
|
+
params: Params<Status>;
|
|
491
|
+
result: Result<Status>;
|
|
492
|
+
};
|
|
493
|
+
connect: {
|
|
494
|
+
params: Params<Connect>;
|
|
495
|
+
result: Result<Connect>;
|
|
496
|
+
};
|
|
497
|
+
disconnect: {
|
|
498
|
+
params: Params<Disconnect>;
|
|
499
|
+
result: Result<Disconnect>;
|
|
500
|
+
};
|
|
501
|
+
getActiveNetwork: {
|
|
502
|
+
params: Params<GetActiveNetwork>;
|
|
503
|
+
result: Result<GetActiveNetwork>;
|
|
504
|
+
};
|
|
505
|
+
prepareExecute: {
|
|
506
|
+
params: Params<PrepareExecute>;
|
|
507
|
+
result: Result<PrepareExecute>;
|
|
508
|
+
};
|
|
509
|
+
prepareExecuteAndWait: {
|
|
510
|
+
params: Params<PrepareExecuteAndWait>;
|
|
511
|
+
result: Result<PrepareExecuteAndWait>;
|
|
512
|
+
};
|
|
513
|
+
signMessage: {
|
|
514
|
+
params: Params<SignMessage>;
|
|
515
|
+
result: Result<SignMessage>;
|
|
516
|
+
};
|
|
517
|
+
ledgerApi: {
|
|
518
|
+
params: Params<LedgerApi>;
|
|
519
|
+
result: Result<LedgerApi>;
|
|
520
|
+
};
|
|
521
|
+
accountsChanged: {
|
|
522
|
+
params: Params<AccountsChanged>;
|
|
523
|
+
result: Result<AccountsChanged>;
|
|
524
|
+
};
|
|
525
|
+
getPrimaryAccount: {
|
|
526
|
+
params: Params<GetPrimaryAccount>;
|
|
527
|
+
result: Result<GetPrimaryAccount>;
|
|
528
|
+
};
|
|
529
|
+
listAccounts: {
|
|
530
|
+
params: Params<ListAccounts>;
|
|
531
|
+
result: Result<ListAccounts>;
|
|
532
|
+
};
|
|
533
|
+
txChanged: {
|
|
534
|
+
params: Params<TxChanged>;
|
|
535
|
+
result: Result<TxChanged>;
|
|
536
|
+
};
|
|
537
|
+
};
|
|
493
538
|
export declare class SpliceWalletJSONRPCDAppAPI {
|
|
494
539
|
transport: RpcTransport;
|
|
495
540
|
constructor(transport: RpcTransport);
|
|
496
|
-
|
|
497
|
-
*
|
|
498
|
-
*/
|
|
499
|
-
request(method: 'status', ...params: Parameters<Status>): ReturnType<Status>;
|
|
500
|
-
/**
|
|
501
|
-
*
|
|
502
|
-
*/
|
|
503
|
-
request(method: 'connect', ...params: Parameters<Connect>): ReturnType<Connect>;
|
|
504
|
-
/**
|
|
505
|
-
*
|
|
506
|
-
*/
|
|
507
|
-
request(method: 'disconnect', ...params: Parameters<Disconnect>): ReturnType<Disconnect>;
|
|
508
|
-
/**
|
|
509
|
-
*
|
|
510
|
-
*/
|
|
511
|
-
request(method: 'getActiveNetwork', ...params: Parameters<GetActiveNetwork>): ReturnType<GetActiveNetwork>;
|
|
512
|
-
/**
|
|
513
|
-
*
|
|
514
|
-
*/
|
|
515
|
-
request(method: 'prepareExecute', ...params: Parameters<PrepareExecute>): ReturnType<PrepareExecute>;
|
|
516
|
-
/**
|
|
517
|
-
*
|
|
518
|
-
*/
|
|
519
|
-
request(method: 'prepareExecuteAndWait', ...params: Parameters<PrepareExecuteAndWait>): ReturnType<PrepareExecuteAndWait>;
|
|
520
|
-
/**
|
|
521
|
-
*
|
|
522
|
-
*/
|
|
523
|
-
request(method: 'signMessage', ...params: Parameters<SignMessage>): ReturnType<SignMessage>;
|
|
524
|
-
/**
|
|
525
|
-
*
|
|
526
|
-
*/
|
|
527
|
-
request(method: 'ledgerApi', ...params: Parameters<LedgerApi>): ReturnType<LedgerApi>;
|
|
528
|
-
/**
|
|
529
|
-
*
|
|
530
|
-
*/
|
|
531
|
-
request(method: 'accountsChanged', ...params: Parameters<AccountsChanged>): ReturnType<AccountsChanged>;
|
|
532
|
-
/**
|
|
533
|
-
*
|
|
534
|
-
*/
|
|
535
|
-
request(method: 'getPrimaryAccount', ...params: Parameters<GetPrimaryAccount>): ReturnType<GetPrimaryAccount>;
|
|
536
|
-
/**
|
|
537
|
-
*
|
|
538
|
-
*/
|
|
539
|
-
request(method: 'listAccounts', ...params: Parameters<ListAccounts>): ReturnType<ListAccounts>;
|
|
540
|
-
/**
|
|
541
|
-
*
|
|
542
|
-
*/
|
|
543
|
-
request(method: 'txChanged', ...params: Parameters<TxChanged>): ReturnType<TxChanged>;
|
|
541
|
+
request<M extends keyof RpcTypes>(args: RequestArgs<RpcTypes, M>): Promise<RpcTypes[M]['result']>;
|
|
544
542
|
}
|
|
545
543
|
export default SpliceWalletJSONRPCDAppAPI;
|
|
546
544
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAkB,MAAM,4BAA4B,CAAA;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAA;AAGjE;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAA;AAE9B;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACrB;AACD;;;;GAIG;AACH,MAAM,MAAM,KAAK,GAAG,MAAM,CAAA;AAC1B;;;;GAIG;AACH,MAAM,MAAM,KAAK,GAAG,KAAK,EAAE,CAAA;AAC3B;;;;GAIG;AACH,MAAM,MAAM,MAAM,GAAG,KAAK,EAAE,CAAA;AAC5B;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAA;AAC/B;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAA;AAC/B;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAA;AACrC;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAA;AACnC;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAC9B,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,gBAAgB,EAAE,gBAAgB,CAAA;IAClC,cAAc,CAAC,EAAE,cAAc,CAAA;CAClC;AACD;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,EAAE,CAAA;AACpD,MAAM,MAAM,SAAS,GAAG,MAAM,CAAA;AAC9B;;;;GAIG;AACH,MAAM,MAAM,4BAA4B,GAAG,SAAS,EAAE,CAAA;AACtD;;;;GAIG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,CA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AC5B,CAAA;IAED,eAAe,EAAE;QACb,MAAM,EAAE,MAAM,CAAC,eAAe,CAAC,CAAA;QAC/B,MAAM,EAAE,MAAM,CAAC,eAAe,CAAC,CAAA;KAClC,CAAA;IAED,iBAAiB,EAAE;QACf,MAAM,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAA;QACjC,MAAM,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAA;KACpC,CAAA;IAED,YAAY,EAAE;QACV,MAAM,EAAE,MAAM,CAAC,YAAY,CAAC,CAAA;QAC5B,MAAM,EAAE,MAAM,CAAC,YAAY,CAAC,CAAA;KAC/B,CAAA;IAED,SAAS,EAAE;QACP,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,CAAA;QACzB,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,CAAA;KAC5B,CAAA;CACJ,CAAA;AAED,qBAAa,0BAA0B;IAC5B,SAAS,EAAE,YAAY,CAAA;gBAElB,SAAS,EAAE,YAAY;IAItB,OAAO,CAAC,CAAC,SAAS,MAAM,QAAQ,EACzC,IAAI,EAAE,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,GAC/B,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;CAcpC;AACD,eAAe,0BAA0B,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -8,8 +8,8 @@ var SpliceWalletJSONRPCDAppAPI = class {
|
|
|
8
8
|
__publicField(this, "transport");
|
|
9
9
|
this.transport = transport;
|
|
10
10
|
}
|
|
11
|
-
async request(
|
|
12
|
-
const response = await this.transport.submit(
|
|
11
|
+
async request(args) {
|
|
12
|
+
const response = await this.transport.submit(args);
|
|
13
13
|
if ("error" in response) {
|
|
14
14
|
throw new Error(
|
|
15
15
|
"RPC error: " + response.error.code + " - " + response.error.message
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;AA2fO,IAAM,6BAAN,MAAiC;AAAA,EAGpC,YAAY,SAAA,EAAyB;AAFrC,IAAA,aAAA,CAAA,IAAA,EAAO,WAAA,CAAA;AAGH,IAAA,IAAA,CAAK,SAAA,GAAY,SAAA;AAAA,EACrB;AAAA,EA8GA,MAAa,OAAA,CACT,MAAA,EACA,MAAA,EACgB;AAChB,IAAA,MAAM,QAAA,GAAW,MAAM,IAAA,CAAK,SAAA,CAAU,OAAO,EAAE,MAAA,EAAQ,QAAQ,CAAA;AAE/D,IAAA,IAAI,WAAW,QAAA,EAAU;AACrB,MAAA,MAAM,IAAI,KAAA;AAAA,QACN,gBACI,QAAA,CAAS,KAAA,CAAM,IAAA,GACf,KAAA,GACA,SAAS,KAAA,CAAM;AAAA,OACvB;AAAA,IACJ,CAAA,MAAO;AACH,MAAA,OAAO,QAAA,CAAS,MAAA;AAAA,IACpB;AAAA,EACJ;AACJ;AACA,IAAO,aAAA,GAAQ","file":"index.js","sourcesContent":["// Code generated by @open-rpc/generator DO NOT EDIT.\nimport _ from 'lodash'\n\nimport { RequestPayload } from '@canton-network/core-types'\nimport { RpcTransport } from '@canton-network/core-rpc-transport'\n\n/**\n *\n * The unique identifier of the command associated with the transaction.\n *\n */\nexport type CommandId = string\n/**\n *\n * Structure representing JS commands for transaction execution\n *\n */\nexport interface JsCommands {\n [key: string]: any\n}\n/**\n *\n * The party that signed the transaction.\n *\n */\nexport type Party = string\n/**\n *\n * Set of parties on whose behalf the command should be executed, if submitted. If not set, the primary wallet's party is used.\n *\n */\nexport type ActAs = Party[]\n/**\n *\n * Set of parties that should be granted read access to the command, if submitted. If not set, no additional read parties are granted.\n *\n */\nexport type ReadAs = Party[]\n/**\n *\n * The template identifier of the disclosed contract.\n *\n */\nexport type TemplateId = string\n/**\n *\n * The unique identifier of the disclosed contract.\n *\n */\nexport type ContractId = string\n/**\n *\n * The blob data of the created event for the disclosed contract.\n *\n */\nexport type CreatedEventBlob = string\n/**\n *\n * If not set, a suitable synchronizer that this node is connected to will be chosen.\n *\n */\nexport type SynchronizerId = string\n/**\n *\n * Structure representing a disclosed contract for transaction execution\n *\n */\nexport interface DisclosedContract {\n templateId?: TemplateId\n contractId?: ContractId\n createdEventBlob: CreatedEventBlob\n synchronizerId?: SynchronizerId\n [k: string]: any\n}\n/**\n *\n * List of contract IDs to be disclosed with the command.\n *\n */\nexport type DisclosedContracts = DisclosedContract[]\nexport type PackageId = string\n/**\n *\n * The package-id selection preference of the client for resolving package names and interface instances in command submission and interpretation\n *\n */\nexport type PackageIdSelectionPreference = PackageId[]\n/**\n *\n * The message to sign.\n *\n */\nexport type Message = string\nexport type RequestMethod = 'GET' | 'POST' | 'PUT' | 'DELETE'\nexport type Resource = string\nexport type Body = string\n/**\n *\n * The unique identifier of the Wallet Gateway.\n *\n */\nexport type Id = string\n/**\n *\n * The type of client that implements the Wallet Gateway.\n *\n */\nexport type ClientType = 'browser' | 'desktop' | 'mobile' | 'remote'\n/**\n *\n * The URL of the Wallet Gateway.\n *\n */\nexport type Url = string\n/**\n *\n * A URL that points to a user interface.\n *\n */\nexport type UserUrl = string\n/**\n *\n * Represents a Wallet Gateway.\n *\n */\nexport interface KernelInfo {\n id: Id\n clientType: ClientType\n url?: Url\n userUrl?: UserUrl\n [k: string]: any\n}\n/**\n *\n * Whether or not the user is authenticated with the Wallet.\n *\n */\nexport type IsConnected = boolean\n/**\n *\n * Whether or not a connection to a network is established.\n *\n */\nexport type IsNetworkConnected = boolean\n/**\n *\n * If not connected to a network, the reason why.\n *\n */\nexport type NetworkReason = string\n/**\n *\n * The network ID the wallet corresponds to.\n *\n */\nexport type NetworkId = string\n/**\n *\n * The base URL of the ledger API.\n *\n */\nexport type BaseUrl = string\n/**\n *\n * Ledger API configuration.\n *\n */\nexport interface LedgerApiConfig {\n baseUrl: BaseUrl\n [k: string]: any\n}\n/**\n *\n * Network information, if connected to a network.\n *\n */\nexport interface Network {\n networkId: NetworkId\n ledgerApi?: LedgerApiConfig\n [k: string]: any\n}\n/**\n *\n * JWT authentication token.\n *\n */\nexport type AccessToken = string\n/**\n *\n * The user identifier.\n *\n */\nexport type UserId = string\n/**\n *\n * Session information, if authenticated.\n *\n */\nexport interface Session {\n accessToken: AccessToken\n userId: UserId\n [k: string]: any\n}\n/**\n *\n * The status of the transaction.\n *\n */\nexport type StatusExecuted = 'executed'\n/**\n *\n * The update ID corresponding to the transaction.\n *\n */\nexport type UpdateId = string\nexport type CompletionOffset = number\n/**\n *\n * Payload for the TxChangedExecutedEvent.\n *\n */\nexport interface TxChangedExecutedPayload {\n updateId: UpdateId\n completionOffset: CompletionOffset\n}\n/**\n *\n * Event emitted when a transaction is executed against the participant.\n *\n */\nexport interface TxChangedExecutedEvent {\n status: StatusExecuted\n commandId: CommandId\n payload: TxChangedExecutedPayload\n}\n/**\n *\n * The signature of the transaction.\n *\n */\nexport type Signature = string\nexport type Response = string\n/**\n *\n * Set as primary wallet for dApp usage.\n *\n */\nexport type Primary = boolean\n/**\n *\n * The party ID corresponding to the wallet.\n *\n */\nexport type PartyId = string\n/**\n *\n * The status of the wallet.\n *\n */\nexport type WalletStatus = 'initialized' | 'allocated'\n/**\n *\n * The party hint and name of the wallet.\n *\n */\nexport type Hint = string\n/**\n *\n * The public key of the party.\n *\n */\nexport type PublicKey = string\n/**\n *\n * The namespace of the party.\n *\n */\nexport type Namespace = string\n/**\n *\n * The signing provider ID the wallet corresponds to.\n *\n */\nexport type SigningProviderId = string\n/**\n *\n * Unique identifier of the signed transaction given by the Signing Provider. This may not be the same as the internal txId given by the Wallet Gateway.\n *\n */\nexport type ExternalTxId = string\n/**\n *\n * The topology transactions\n *\n */\nexport type TopologyTransactions = string\n/**\n *\n * Whether the wallet is disabled. Wallets are disabled when no signing provider matches the party's namespace during sync. Disabled wallets use participant as the default signing provider.\n *\n */\nexport type Disabled = boolean\n/**\n *\n * Reason for the wallet state, e.g., 'no signing provider matched'.\n *\n */\nexport type Reason = string\n/**\n *\n * Structure representing a wallet\n *\n */\nexport interface Wallet {\n primary: Primary\n partyId: PartyId\n status: WalletStatus\n hint: Hint\n publicKey: PublicKey\n namespace: Namespace\n networkId: NetworkId\n signingProviderId: SigningProviderId\n externalTxId?: ExternalTxId\n topologyTransactions?: TopologyTransactions\n disabled?: Disabled\n reason?: Reason\n [k: string]: any\n}\n/**\n *\n * The status of the transaction.\n *\n */\nexport type StatusPending = 'pending'\n/**\n *\n * Event emitted when a transaction is pending.\n *\n */\nexport interface TxChangedPendingEvent {\n status: StatusPending\n commandId: CommandId\n}\n/**\n *\n * The status of the transaction.\n *\n */\nexport type StatusSigned = 'signed'\n/**\n *\n * The identifier of the provider that signed the transaction.\n *\n */\nexport type SignedBy = string\n/**\n *\n * Payload for the TxChangedSignedEvent.\n *\n */\nexport interface TxChangedSignedPayload {\n signature: Signature\n signedBy: SignedBy\n party: Party\n}\n/**\n *\n * Event emitted when a transaction has been signed.\n *\n */\nexport interface TxChangedSignedEvent {\n status: StatusSigned\n commandId: CommandId\n payload: TxChangedSignedPayload\n}\n/**\n *\n * The status of the transaction.\n *\n */\nexport type StatusFailed = 'failed'\n/**\n *\n * Event emitted when a transaction has failed.\n *\n */\nexport interface TxChangedFailedEvent {\n status: StatusFailed\n commandId: CommandId\n}\n/**\n *\n * Structure representing the request for prepare and execute calls\n *\n */\nexport interface PrepareExecuteParams {\n commandId?: CommandId\n commands: JsCommands\n actAs?: ActAs\n readAs?: ReadAs\n disclosedContracts?: DisclosedContracts\n synchronizerId?: SynchronizerId\n packageIdSelectionPreference?: PackageIdSelectionPreference\n [k: string]: any\n}\n/**\n *\n * Request to sign a message.\n *\n */\nexport interface SignMessageParams {\n message: Message\n [k: string]: any\n}\n/**\n *\n * Ledger API request structure\n *\n */\nexport interface LedgerApiParams {\n requestMethod: RequestMethod\n resource: Resource\n body?: Body\n [k: string]: any\n}\nexport interface StatusEvent {\n kernel: KernelInfo\n isConnected: IsConnected\n isNetworkConnected: IsNetworkConnected\n networkReason?: NetworkReason\n network?: Network\n session?: Session\n [k: string]: any\n}\n/**\n *\n * Represents a null value, used in responses where no data is returned.\n *\n */\nexport type Null = null\nexport interface PrepareExecuteAndWaitResult {\n tx: TxChangedExecutedEvent\n [k: string]: any\n}\n/**\n *\n * Result of signing a message.\n *\n */\nexport interface SignMessageResult {\n signature: Signature\n [k: string]: any\n}\n/**\n *\n * Ledger Api configuration options\n *\n */\nexport interface LedgerApiResult {\n response: Response\n [k: string]: any\n}\n/**\n *\n * Event emitted when the user's accounts change.\n *\n */\nexport type AccountsChangedEvent = Wallet[]\n/**\n *\n * An array of accounts that the user has authorized the dapp to access..\n *\n */\nexport type ListAccountsResult = Wallet[]\n/**\n *\n * Event emitted when a transaction changes.\n *\n */\nexport type TxChangedEvent =\n | TxChangedPendingEvent\n | TxChangedSignedEvent\n | TxChangedExecutedEvent\n | TxChangedFailedEvent\n/**\n *\n * Generated! Represents an alias to any of the provided schemas\n *\n */\n\nexport type Status = () => Promise<StatusEvent>\nexport type Connect = () => Promise<StatusEvent>\nexport type Disconnect = () => Promise<Null>\nexport type GetActiveNetwork = () => Promise<Network>\nexport type PrepareExecute = (params: PrepareExecuteParams) => Promise<Null>\nexport type PrepareExecuteAndWait = (\n params: PrepareExecuteParams\n) => Promise<PrepareExecuteAndWaitResult>\nexport type SignMessage = (\n params: SignMessageParams\n) => Promise<SignMessageResult>\nexport type LedgerApi = (params: LedgerApiParams) => Promise<LedgerApiResult>\nexport type AccountsChanged = () => Promise<AccountsChangedEvent>\nexport type GetPrimaryAccount = () => Promise<Wallet>\nexport type ListAccounts = () => Promise<ListAccountsResult>\nexport type TxChanged = () => Promise<TxChangedEvent>\n\nexport class SpliceWalletJSONRPCDAppAPI {\n public transport: RpcTransport\n\n constructor(transport: RpcTransport) {\n this.transport = transport\n }\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'status',\n ...params: Parameters<Status>\n ): ReturnType<Status>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'connect',\n ...params: Parameters<Connect>\n ): ReturnType<Connect>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'disconnect',\n ...params: Parameters<Disconnect>\n ): ReturnType<Disconnect>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'getActiveNetwork',\n ...params: Parameters<GetActiveNetwork>\n ): ReturnType<GetActiveNetwork>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'prepareExecute',\n ...params: Parameters<PrepareExecute>\n ): ReturnType<PrepareExecute>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'prepareExecuteAndWait',\n ...params: Parameters<PrepareExecuteAndWait>\n ): ReturnType<PrepareExecuteAndWait>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'signMessage',\n ...params: Parameters<SignMessage>\n ): ReturnType<SignMessage>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'ledgerApi',\n ...params: Parameters<LedgerApi>\n ): ReturnType<LedgerApi>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'accountsChanged',\n ...params: Parameters<AccountsChanged>\n ): ReturnType<AccountsChanged>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'getPrimaryAccount',\n ...params: Parameters<GetPrimaryAccount>\n ): ReturnType<GetPrimaryAccount>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'listAccounts',\n ...params: Parameters<ListAccounts>\n ): ReturnType<ListAccounts>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'txChanged',\n ...params: Parameters<TxChanged>\n ): ReturnType<TxChanged>\n\n public async request(\n method: string,\n params?: RequestPayload['params']\n ): Promise<unknown> {\n const response = await this.transport.submit({ method, params })\n\n if ('error' in response) {\n throw new Error(\n 'RPC error: ' +\n response.error.code +\n ' - ' +\n response.error.message\n )\n } else {\n return response.result\n }\n }\n}\nexport default SpliceWalletJSONRPCDAppAPI\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;AA2jBO,IAAM,6BAAN,MAAiC;AAAA,EAGpC,YAAY,SAAA,EAAyB;AAFrC,IAAA,aAAA,CAAA,IAAA,EAAO,WAAA,CAAA;AAGH,IAAA,IAAA,CAAK,SAAA,GAAY,SAAA;AAAA,EACrB;AAAA,EAEA,MAAa,QACT,IAAA,EAC8B;AAC9B,IAAA,MAAM,QAAA,GAAW,MAAM,IAAA,CAAK,SAAA,CAAU,OAAO,IAAsB,CAAA;AAEnE,IAAA,IAAI,WAAW,QAAA,EAAU;AACrB,MAAA,MAAM,IAAI,KAAA;AAAA,QACN,gBACI,QAAA,CAAS,KAAA,CAAM,IAAA,GACf,KAAA,GACA,SAAS,KAAA,CAAM;AAAA,OACvB;AAAA,IACJ,CAAA,MAAO;AACH,MAAA,OAAO,QAAA,CAAS,MAAA;AAAA,IACpB;AAAA,EACJ;AACJ;AACA,IAAO,aAAA,GAAQ","file":"index.js","sourcesContent":["// Code generated by @open-rpc/generator DO NOT EDIT.\nimport _ from 'lodash'\n\nimport { RequestArgs, RequestPayload } from '@canton-network/core-types'\nimport { RpcTransport } from '@canton-network/core-rpc-transport'\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n/**\n *\n * The unique identifier of the command associated with the transaction.\n *\n */\nexport type CommandId = string\ntype AlwaysTrue = any\n/**\n *\n * Structure representing JS commands for transaction execution\n *\n */\nexport interface JsCommands {\n [key: string]: any\n}\n/**\n *\n * The party that signed the transaction.\n *\n */\nexport type Party = string\n/**\n *\n * Set of parties on whose behalf the command should be executed, if submitted. If not set, the primary wallet's party is used.\n *\n */\nexport type ActAs = Party[]\n/**\n *\n * Set of parties that should be granted read access to the command, if submitted. If not set, no additional read parties are granted.\n *\n */\nexport type ReadAs = Party[]\n/**\n *\n * The template identifier of the disclosed contract.\n *\n */\nexport type TemplateId = string\n/**\n *\n * The unique identifier of the disclosed contract.\n *\n */\nexport type ContractId = string\n/**\n *\n * The blob data of the created event for the disclosed contract.\n *\n */\nexport type CreatedEventBlob = string\n/**\n *\n * If not set, a suitable synchronizer that this node is connected to will be chosen.\n *\n */\nexport type SynchronizerId = string\n/**\n *\n * Structure representing a disclosed contract for transaction execution\n *\n */\nexport interface DisclosedContract {\n templateId?: TemplateId\n contractId?: ContractId\n createdEventBlob: CreatedEventBlob\n synchronizerId?: SynchronizerId\n}\n/**\n *\n * List of contract IDs to be disclosed with the command.\n *\n */\nexport type DisclosedContracts = DisclosedContract[]\nexport type PackageId = string\n/**\n *\n * The package-id selection preference of the client for resolving package names and interface instances in command submission and interpretation\n *\n */\nexport type PackageIdSelectionPreference = PackageId[]\n/**\n *\n * The message to sign.\n *\n */\nexport type Message = string\nexport type RequestMethod = 'GET' | 'POST' | 'PUT' | 'DELETE'\nexport type Resource = string\nexport type Body = string\n/**\n *\n * The unique identifier of the Provider.\n *\n */\nexport type Id = string\n/**\n *\n * The version of the Provider.\n *\n */\nexport type Version = string\n/**\n *\n * The type of client that implements the Provider.\n *\n */\nexport type ProviderType = 'browser' | 'desktop' | 'mobile' | 'remote'\n/**\n *\n * The URL of the Wallet Provider.\n *\n */\nexport type Url = string\n/**\n *\n * A URL that points to a user interface.\n *\n */\nexport type UserUrl = string\n/**\n *\n * Represents a Provider.\n *\n */\nexport interface Provider {\n id: Id\n version?: Version\n providerType?: ProviderType\n url?: Url\n userUrl?: UserUrl\n}\n/**\n *\n * Whether or not the user is authenticated with the Wallet.\n *\n */\nexport type IsConnected = boolean\n/**\n *\n * Reason for the wallet state, e.g., 'no signing provider matched'.\n *\n */\nexport type Reason = string\n/**\n *\n * Whether or not a connection to a network is established.\n *\n */\nexport type IsNetworkConnected = boolean\n/**\n *\n * If not connected to a network, the reason why.\n *\n */\nexport type NetworkReason = string\nexport interface ConnectResult {\n isConnected: IsConnected\n reason?: Reason\n isNetworkConnected: IsNetworkConnected\n networkReason?: NetworkReason\n userUrl?: UserUrl\n}\n/**\n *\n * The network ID the wallet corresponds to.\n *\n */\nexport type NetworkId = string\n/**\n *\n * The base URL of the ledger API.\n *\n */\nexport type LedgerApiUrl = string\n/**\n *\n * JWT authentication token.\n *\n */\nexport type AccessToken = string\n/**\n *\n * Network information, if connected to a network.\n *\n */\nexport interface Network {\n networkId: NetworkId\n ledgerApi?: LedgerApiUrl\n accessToken?: AccessToken\n}\n/**\n *\n * The user identifier.\n *\n */\nexport type UserId = string\n/**\n *\n * Session information, if authenticated.\n *\n */\nexport interface Session {\n accessToken: AccessToken\n userId: UserId\n}\n/**\n *\n * The status of the transaction.\n *\n */\nexport type StatusExecuted = 'executed'\n/**\n *\n * The update ID corresponding to the transaction.\n *\n */\nexport type UpdateId = string\nexport type CompletionOffset = number\n/**\n *\n * Payload for the TxChangedExecutedEvent.\n *\n */\nexport interface TxChangedExecutedPayload {\n updateId: UpdateId\n completionOffset: CompletionOffset\n}\n/**\n *\n * Event emitted when a transaction is executed against the participant.\n *\n */\nexport interface TxChangedExecutedEvent {\n status: StatusExecuted\n commandId: CommandId\n payload: TxChangedExecutedPayload\n}\n/**\n *\n * The signature of the transaction.\n *\n */\nexport type Signature = string\nexport type Response = string\n/**\n *\n * Set as primary wallet for dApp usage.\n *\n */\nexport type Primary = boolean\n/**\n *\n * The party ID corresponding to the wallet.\n *\n */\nexport type PartyId = string\n/**\n *\n * The status of the wallet.\n *\n */\nexport type WalletStatus = 'initialized' | 'allocated'\n/**\n *\n * The party hint and name of the wallet.\n *\n */\nexport type Hint = string\n/**\n *\n * The public key of the party.\n *\n */\nexport type PublicKey = string\n/**\n *\n * The namespace of the party.\n *\n */\nexport type Namespace = string\n/**\n *\n * The signing provider ID the wallet corresponds to.\n *\n */\nexport type SigningProviderId = string\n/**\n *\n * Unique identifier of the signed transaction given by the Signing Provider. This may not be the same as the internal txId given by the Wallet Gateway.\n *\n */\nexport type ExternalTxId = string\n/**\n *\n * The topology transactions\n *\n */\nexport type TopologyTransactions = string\n/**\n *\n * Whether the wallet is disabled. Wallets are disabled when no signing provider matches the party's namespace during sync. Disabled wallets use participant as the default signing provider.\n *\n */\nexport type Disabled = boolean\n/**\n *\n * Structure representing a wallet\n *\n */\nexport interface Wallet {\n primary: Primary\n partyId: PartyId\n status: WalletStatus\n hint: Hint\n publicKey: PublicKey\n namespace: Namespace\n networkId: NetworkId\n signingProviderId: SigningProviderId\n externalTxId?: ExternalTxId\n topologyTransactions?: TopologyTransactions\n disabled?: Disabled\n reason?: Reason\n}\n/**\n *\n * The status of the transaction.\n *\n */\nexport type StatusPending = 'pending'\n/**\n *\n * Event emitted when a transaction is pending.\n *\n */\nexport interface TxChangedPendingEvent {\n status: StatusPending\n commandId: CommandId\n}\n/**\n *\n * The status of the transaction.\n *\n */\nexport type StatusSigned = 'signed'\n/**\n *\n * The identifier of the provider that signed the transaction.\n *\n */\nexport type SignedBy = string\n/**\n *\n * Payload for the TxChangedSignedEvent.\n *\n */\nexport interface TxChangedSignedPayload {\n signature: Signature\n signedBy: SignedBy\n party: Party\n}\n/**\n *\n * Event emitted when a transaction has been signed.\n *\n */\nexport interface TxChangedSignedEvent {\n status: StatusSigned\n commandId: CommandId\n payload: TxChangedSignedPayload\n}\n/**\n *\n * The status of the transaction.\n *\n */\nexport type StatusFailed = 'failed'\n/**\n *\n * Event emitted when a transaction has failed.\n *\n */\nexport interface TxChangedFailedEvent {\n status: StatusFailed\n commandId: CommandId\n}\n/**\n *\n * Structure representing the request for prepare and execute calls\n *\n */\nexport interface PrepareExecuteParams {\n commandId?: CommandId\n commands: JsCommands\n actAs?: ActAs\n readAs?: ReadAs\n disclosedContracts?: DisclosedContracts\n synchronizerId?: SynchronizerId\n packageIdSelectionPreference?: PackageIdSelectionPreference\n}\n/**\n *\n * Request to sign a message.\n *\n */\nexport interface SignMessageParams {\n message: Message\n}\n/**\n *\n * Ledger API request structure\n *\n */\nexport interface LedgerApiParams {\n requestMethod: RequestMethod\n resource: Resource\n body?: Body\n}\nexport interface StatusEvent {\n provider: Provider\n connection: ConnectResult\n network?: Network\n session?: Session\n}\n/**\n *\n * Represents a null value, used in responses where no data is returned.\n *\n */\nexport type Null = null\nexport interface PrepareExecuteAndWaitResult {\n tx: TxChangedExecutedEvent\n}\n/**\n *\n * Result of signing a message.\n *\n */\nexport interface SignMessageResult {\n signature: Signature\n}\n/**\n *\n * Ledger Api configuration options\n *\n */\nexport interface LedgerApiResult {\n response: Response\n}\n/**\n *\n * Event emitted when the user's accounts change.\n *\n */\nexport type AccountsChangedEvent = Wallet[]\n/**\n *\n * An array of accounts that the user has authorized the dapp to access..\n *\n */\nexport type ListAccountsResult = Wallet[]\n/**\n *\n * Event emitted when a transaction changes.\n *\n */\nexport type TxChangedEvent =\n | TxChangedPendingEvent\n | TxChangedSignedEvent\n | TxChangedExecutedEvent\n | TxChangedFailedEvent\n/**\n *\n * Generated! Represents an alias to any of the provided schemas\n *\n */\n\nexport type Status = () => Promise<StatusEvent>\nexport type Connect = () => Promise<ConnectResult>\nexport type Disconnect = () => Promise<Null>\nexport type GetActiveNetwork = () => Promise<Network>\nexport type PrepareExecute = (params: PrepareExecuteParams) => Promise<Null>\nexport type PrepareExecuteAndWait = (\n params: PrepareExecuteParams\n) => Promise<PrepareExecuteAndWaitResult>\nexport type SignMessage = (\n params: SignMessageParams\n) => Promise<SignMessageResult>\nexport type LedgerApi = (params: LedgerApiParams) => Promise<LedgerApiResult>\nexport type AccountsChanged = () => Promise<AccountsChangedEvent>\nexport type GetPrimaryAccount = () => Promise<Wallet>\nexport type ListAccounts = () => Promise<ListAccountsResult>\nexport type TxChanged = () => Promise<TxChangedEvent>\n/* eslint-enable @typescript-eslint/no-unused-vars */\n\ntype Params<T> = T extends (...args: infer A) => any\n ? A extends []\n ? never\n : A[0]\n : never\ntype Result<T> = T extends (...args: any[]) => Promise<infer R> ? R : never\n\nexport type RpcTypes = {\n status: {\n params: Params<Status>\n result: Result<Status>\n }\n\n connect: {\n params: Params<Connect>\n result: Result<Connect>\n }\n\n disconnect: {\n params: Params<Disconnect>\n result: Result<Disconnect>\n }\n\n getActiveNetwork: {\n params: Params<GetActiveNetwork>\n result: Result<GetActiveNetwork>\n }\n\n prepareExecute: {\n params: Params<PrepareExecute>\n result: Result<PrepareExecute>\n }\n\n prepareExecuteAndWait: {\n params: Params<PrepareExecuteAndWait>\n result: Result<PrepareExecuteAndWait>\n }\n\n signMessage: {\n params: Params<SignMessage>\n result: Result<SignMessage>\n }\n\n ledgerApi: {\n params: Params<LedgerApi>\n result: Result<LedgerApi>\n }\n\n accountsChanged: {\n params: Params<AccountsChanged>\n result: Result<AccountsChanged>\n }\n\n getPrimaryAccount: {\n params: Params<GetPrimaryAccount>\n result: Result<GetPrimaryAccount>\n }\n\n listAccounts: {\n params: Params<ListAccounts>\n result: Result<ListAccounts>\n }\n\n txChanged: {\n params: Params<TxChanged>\n result: Result<TxChanged>\n }\n}\n\nexport class SpliceWalletJSONRPCDAppAPI {\n public transport: RpcTransport\n\n constructor(transport: RpcTransport) {\n this.transport = transport\n }\n\n public async request<M extends keyof RpcTypes>(\n args: RequestArgs<RpcTypes, M>\n ): Promise<RpcTypes[M]['result']> {\n const response = await this.transport.submit(args as RequestPayload)\n\n if ('error' in response) {\n throw new Error(\n 'RPC error: ' +\n response.error.code +\n ' - ' +\n response.error.message\n )\n } else {\n return response.result as RpcTypes[M]['result']\n }\n }\n}\nexport default SpliceWalletJSONRPCDAppAPI\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canton-network/core-wallet-dapp-rpc-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "TypeScript client generated by OpenRPC",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@canton-network/core-rpc-transport": "^0.
|
|
33
|
-
"@canton-network/core-types": "^0.
|
|
32
|
+
"@canton-network/core-rpc-transport": "^0.5.0",
|
|
33
|
+
"@canton-network/core-types": "^0.19.0",
|
|
34
34
|
"lodash": "^4.17.23"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|