@canton-network/core-wallet-dapp-rpc-client 0.23.0 → 0.25.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 +57 -63
- 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":";;;;;;;;;AA+fO,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 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 [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 * 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 [k: string]: any\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 [k: string]: any\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 [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 * 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 provider: Provider\n connection: ConnectResult\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<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\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 ProviderId = 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: ProviderId\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
|
*
|
|
@@ -94,7 +94,7 @@ export type Body = string;
|
|
|
94
94
|
* The unique identifier of the Provider.
|
|
95
95
|
*
|
|
96
96
|
*/
|
|
97
|
-
export type
|
|
97
|
+
export type ProviderId = string;
|
|
98
98
|
/**
|
|
99
99
|
*
|
|
100
100
|
* The version of the Provider.
|
|
@@ -125,12 +125,11 @@ export type UserUrl = string;
|
|
|
125
125
|
*
|
|
126
126
|
*/
|
|
127
127
|
export interface Provider {
|
|
128
|
-
id:
|
|
128
|
+
id: ProviderId;
|
|
129
129
|
version?: Version;
|
|
130
130
|
providerType?: ProviderType;
|
|
131
131
|
url?: Url;
|
|
132
132
|
userUrl?: UserUrl;
|
|
133
|
-
[k: string]: any;
|
|
134
133
|
}
|
|
135
134
|
/**
|
|
136
135
|
*
|
|
@@ -161,7 +160,7 @@ export interface ConnectResult {
|
|
|
161
160
|
reason?: Reason;
|
|
162
161
|
isNetworkConnected: IsNetworkConnected;
|
|
163
162
|
networkReason?: NetworkReason;
|
|
164
|
-
|
|
163
|
+
userUrl?: UserUrl;
|
|
165
164
|
}
|
|
166
165
|
/**
|
|
167
166
|
*
|
|
@@ -190,7 +189,6 @@ export interface Network {
|
|
|
190
189
|
networkId: NetworkId;
|
|
191
190
|
ledgerApi?: LedgerApiUrl;
|
|
192
191
|
accessToken?: AccessToken;
|
|
193
|
-
[k: string]: any;
|
|
194
192
|
}
|
|
195
193
|
/**
|
|
196
194
|
*
|
|
@@ -206,7 +204,6 @@ export type UserId = string;
|
|
|
206
204
|
export interface Session {
|
|
207
205
|
accessToken: AccessToken;
|
|
208
206
|
userId: UserId;
|
|
209
|
-
[k: string]: any;
|
|
210
207
|
}
|
|
211
208
|
/**
|
|
212
209
|
*
|
|
@@ -325,7 +322,6 @@ export interface Wallet {
|
|
|
325
322
|
topologyTransactions?: TopologyTransactions;
|
|
326
323
|
disabled?: Disabled;
|
|
327
324
|
reason?: Reason;
|
|
328
|
-
[k: string]: any;
|
|
329
325
|
}
|
|
330
326
|
/**
|
|
331
327
|
*
|
|
@@ -402,7 +398,6 @@ export interface PrepareExecuteParams {
|
|
|
402
398
|
disclosedContracts?: DisclosedContracts;
|
|
403
399
|
synchronizerId?: SynchronizerId;
|
|
404
400
|
packageIdSelectionPreference?: PackageIdSelectionPreference;
|
|
405
|
-
[k: string]: any;
|
|
406
401
|
}
|
|
407
402
|
/**
|
|
408
403
|
*
|
|
@@ -411,7 +406,6 @@ export interface PrepareExecuteParams {
|
|
|
411
406
|
*/
|
|
412
407
|
export interface SignMessageParams {
|
|
413
408
|
message: Message;
|
|
414
|
-
[k: string]: any;
|
|
415
409
|
}
|
|
416
410
|
/**
|
|
417
411
|
*
|
|
@@ -422,14 +416,12 @@ export interface LedgerApiParams {
|
|
|
422
416
|
requestMethod: RequestMethod;
|
|
423
417
|
resource: Resource;
|
|
424
418
|
body?: Body;
|
|
425
|
-
[k: string]: any;
|
|
426
419
|
}
|
|
427
420
|
export interface StatusEvent {
|
|
428
421
|
provider: Provider;
|
|
429
422
|
connection: ConnectResult;
|
|
430
423
|
network?: Network;
|
|
431
424
|
session?: Session;
|
|
432
|
-
[k: string]: any;
|
|
433
425
|
}
|
|
434
426
|
/**
|
|
435
427
|
*
|
|
@@ -439,7 +431,6 @@ export interface StatusEvent {
|
|
|
439
431
|
export type Null = null;
|
|
440
432
|
export interface PrepareExecuteAndWaitResult {
|
|
441
433
|
tx: TxChangedExecutedEvent;
|
|
442
|
-
[k: string]: any;
|
|
443
434
|
}
|
|
444
435
|
/**
|
|
445
436
|
*
|
|
@@ -448,7 +439,6 @@ export interface PrepareExecuteAndWaitResult {
|
|
|
448
439
|
*/
|
|
449
440
|
export interface SignMessageResult {
|
|
450
441
|
signature: Signature;
|
|
451
|
-
[k: string]: any;
|
|
452
442
|
}
|
|
453
443
|
/**
|
|
454
444
|
*
|
|
@@ -457,7 +447,6 @@ export interface SignMessageResult {
|
|
|
457
447
|
*/
|
|
458
448
|
export interface LedgerApiResult {
|
|
459
449
|
response: Response;
|
|
460
|
-
[k: string]: any;
|
|
461
450
|
}
|
|
462
451
|
/**
|
|
463
452
|
*
|
|
@@ -494,57 +483,62 @@ export type AccountsChanged = () => Promise<AccountsChangedEvent>;
|
|
|
494
483
|
export type GetPrimaryAccount = () => Promise<Wallet>;
|
|
495
484
|
export type ListAccounts = () => Promise<ListAccountsResult>;
|
|
496
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
|
+
};
|
|
497
538
|
export declare class SpliceWalletJSONRPCDAppAPI {
|
|
498
539
|
transport: RpcTransport;
|
|
499
540
|
constructor(transport: RpcTransport);
|
|
500
|
-
|
|
501
|
-
*
|
|
502
|
-
*/
|
|
503
|
-
request(method: 'status', ...params: Parameters<Status>): ReturnType<Status>;
|
|
504
|
-
/**
|
|
505
|
-
*
|
|
506
|
-
*/
|
|
507
|
-
request(method: 'connect', ...params: Parameters<Connect>): ReturnType<Connect>;
|
|
508
|
-
/**
|
|
509
|
-
*
|
|
510
|
-
*/
|
|
511
|
-
request(method: 'disconnect', ...params: Parameters<Disconnect>): ReturnType<Disconnect>;
|
|
512
|
-
/**
|
|
513
|
-
*
|
|
514
|
-
*/
|
|
515
|
-
request(method: 'getActiveNetwork', ...params: Parameters<GetActiveNetwork>): ReturnType<GetActiveNetwork>;
|
|
516
|
-
/**
|
|
517
|
-
*
|
|
518
|
-
*/
|
|
519
|
-
request(method: 'prepareExecute', ...params: Parameters<PrepareExecute>): ReturnType<PrepareExecute>;
|
|
520
|
-
/**
|
|
521
|
-
*
|
|
522
|
-
*/
|
|
523
|
-
request(method: 'prepareExecuteAndWait', ...params: Parameters<PrepareExecuteAndWait>): ReturnType<PrepareExecuteAndWait>;
|
|
524
|
-
/**
|
|
525
|
-
*
|
|
526
|
-
*/
|
|
527
|
-
request(method: 'signMessage', ...params: Parameters<SignMessage>): ReturnType<SignMessage>;
|
|
528
|
-
/**
|
|
529
|
-
*
|
|
530
|
-
*/
|
|
531
|
-
request(method: 'ledgerApi', ...params: Parameters<LedgerApi>): ReturnType<LedgerApi>;
|
|
532
|
-
/**
|
|
533
|
-
*
|
|
534
|
-
*/
|
|
535
|
-
request(method: 'accountsChanged', ...params: Parameters<AccountsChanged>): ReturnType<AccountsChanged>;
|
|
536
|
-
/**
|
|
537
|
-
*
|
|
538
|
-
*/
|
|
539
|
-
request(method: 'getPrimaryAccount', ...params: Parameters<GetPrimaryAccount>): ReturnType<GetPrimaryAccount>;
|
|
540
|
-
/**
|
|
541
|
-
*
|
|
542
|
-
*/
|
|
543
|
-
request(method: 'listAccounts', ...params: Parameters<ListAccounts>): ReturnType<ListAccounts>;
|
|
544
|
-
/**
|
|
545
|
-
*
|
|
546
|
-
*/
|
|
547
|
-
request(method: 'txChanged', ...params: Parameters<TxChanged>): ReturnType<TxChanged>;
|
|
541
|
+
request<M extends keyof RpcTypes>(args: RequestArgs<RpcTypes, M>): Promise<RpcTypes[M]['result']>;
|
|
548
542
|
}
|
|
549
543
|
export default SpliceWalletJSONRPCDAppAPI;
|
|
550
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,CAA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AA;KACxC,CAAA;IAED,WAAW,EAAE;QACT,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,CAAA;QAC3B,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,CAAA;KAC9B,CAAA;IAED,SAAS,EAAE;QACP,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,CAAA;QACzB,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,CAAA;KAC5B,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":";;;;;AA+fO,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 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 [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 * 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 [k: string]: any\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 [k: string]: any\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 [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 * 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 provider: Provider\n connection: ConnectResult\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<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\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 ProviderId = 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: ProviderId\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.25.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.6.0",
|
|
33
|
+
"@canton-network/core-types": "^0.20.0",
|
|
34
34
|
"lodash": "^4.17.23"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|