@digitalworld/digital-world-sdk 16.0.0 → 16.0.1
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/README.md +5 -5
- package/dist/digital-world-sdk-axios.js +52 -47
- package/dist/digital-world-sdk-axios.js.map +1 -1
- package/dist/digital-world-sdk-axios.min.js +1 -1
- package/dist/digital-world-sdk-axios.min.js.map +1 -1
- package/dist/digital-world-sdk.js +52 -47
- package/dist/digital-world-sdk.js.map +1 -1
- package/dist/digital-world-sdk.min.js +6 -6
- package/dist/digital-world-sdk.min.js.map +1 -1
- package/lib/axios/cjs/base/contract.js +2 -2
- package/lib/axios/cjs/base/contract.js.map +1 -1
- package/lib/axios/cjs/base/invocation.js.map +1 -1
- package/lib/axios/cjs/base/numbers/sc_int.js +1 -1
- package/lib/axios/cjs/base/numbers/sc_int.js.map +1 -1
- package/lib/axios/cjs/base/operation.js +1 -1
- package/lib/axios/cjs/base/operation.js.map +1 -1
- package/lib/axios/cjs/base/operations/invoke_host_function.js +2 -2
- package/lib/axios/cjs/base/operations/invoke_host_function.js.map +1 -1
- package/lib/axios/cjs/base/operations/revoke_sponsorship.js.map +1 -1
- package/lib/axios/cjs/bindings/config.js +4 -4
- package/lib/axios/cjs/bindings/config.js.map +1 -1
- package/lib/axios/cjs/bindings/generator.js +4 -4
- package/lib/axios/cjs/bindings/generator.js.map +1 -1
- package/lib/axios/cjs/bindings/types.js.map +1 -1
- package/lib/axios/cjs/bindings/utils.js +2 -2
- package/lib/axios/cjs/bindings/utils.js.map +1 -1
- package/lib/axios/cjs/bindings/wasm_fetcher.js +2 -2
- package/lib/axios/cjs/bindings/wasm_fetcher.js.map +1 -1
- package/lib/axios/cjs/contract/assembled_transaction.js.map +1 -1
- package/lib/axios/cjs/contract/spec.js +1 -1
- package/lib/axios/cjs/contract/spec.js.map +1 -1
- package/lib/axios/cjs/contract/types.js.map +1 -1
- package/lib/axios/cjs/gateway/gateway_axios_client.js +1 -1
- package/lib/axios/cjs/gateway/server_api.js.map +1 -1
- package/lib/axios/cjs/rpc/api.js.map +1 -1
- package/lib/axios/cjs/rpc/axios.js +1 -1
- package/lib/axios/cjs/rpc/server.js +32 -27
- package/lib/axios/cjs/rpc/server.js.map +1 -1
- package/lib/axios/cjs/webauth/utils.js.map +1 -1
- package/lib/axios/esm/base/contract.d.ts +4 -4
- package/lib/axios/esm/base/contract.js +2 -2
- package/lib/axios/esm/base/contract.js.map +1 -1
- package/lib/axios/esm/base/invocation.d.ts +2 -2
- package/lib/axios/esm/base/invocation.js.map +1 -1
- package/lib/axios/esm/base/numbers/sc_int.d.ts +2 -2
- package/lib/axios/esm/base/numbers/sc_int.js +1 -1
- package/lib/axios/esm/base/numbers/sc_int.js.map +1 -1
- package/lib/axios/esm/base/operation.d.ts +2 -2
- package/lib/axios/esm/base/operation.js +2 -2
- package/lib/axios/esm/base/operation.js.map +1 -1
- package/lib/axios/esm/base/operations/index.d.ts +1 -1
- package/lib/axios/esm/base/operations/invoke_host_function.d.ts +5 -5
- package/lib/axios/esm/base/operations/invoke_host_function.js +2 -2
- package/lib/axios/esm/base/operations/invoke_host_function.js.map +1 -1
- package/lib/axios/esm/base/operations/revoke_sponsorship.d.ts +1 -1
- package/lib/axios/esm/base/operations/revoke_sponsorship.js.map +1 -1
- package/lib/axios/esm/base/operations/types.d.ts +2 -2
- package/lib/axios/esm/bindings/config.js +4 -4
- package/lib/axios/esm/bindings/config.js.map +1 -1
- package/lib/axios/esm/bindings/generator.d.ts +7 -7
- package/lib/axios/esm/bindings/generator.js +4 -4
- package/lib/axios/esm/bindings/generator.js.map +1 -1
- package/lib/axios/esm/bindings/types.d.ts +1 -1
- package/lib/axios/esm/bindings/types.js.map +1 -1
- package/lib/axios/esm/bindings/utils.d.ts +4 -4
- package/lib/axios/esm/bindings/utils.js +2 -2
- package/lib/axios/esm/bindings/utils.js.map +1 -1
- package/lib/axios/esm/bindings/wasm_fetcher.js +2 -2
- package/lib/axios/esm/bindings/wasm_fetcher.js.map +1 -1
- package/lib/axios/esm/contract/assembled_transaction.d.ts +1 -1
- package/lib/axios/esm/contract/assembled_transaction.js.map +1 -1
- package/lib/axios/esm/contract/spec.js +1 -1
- package/lib/axios/esm/contract/spec.js.map +1 -1
- package/lib/axios/esm/contract/types.d.ts +2 -2
- package/lib/axios/esm/contract/types.js.map +1 -1
- package/lib/axios/esm/gateway/gateway_axios_client.js +1 -1
- package/lib/axios/esm/gateway/server_api.d.ts +2 -2
- package/lib/axios/esm/gateway/server_api.js.map +1 -1
- package/lib/axios/esm/rpc/api.d.ts +1 -1
- package/lib/axios/esm/rpc/api.js.map +1 -1
- package/lib/axios/esm/rpc/axios.js +1 -1
- package/lib/axios/esm/rpc/browser.d.ts +1 -1
- package/lib/axios/esm/rpc/server.d.ts +26 -26
- package/lib/axios/esm/rpc/server.js +32 -27
- package/lib/axios/esm/rpc/server.js.map +1 -1
- package/lib/axios/esm/webauth/utils.d.ts +2 -2
- package/lib/axios/esm/webauth/utils.js.map +1 -1
- package/lib/cjs/base/contract.js +2 -2
- package/lib/cjs/base/contract.js.map +1 -1
- package/lib/cjs/base/invocation.js.map +1 -1
- package/lib/cjs/base/numbers/sc_int.js +1 -1
- package/lib/cjs/base/numbers/sc_int.js.map +1 -1
- package/lib/cjs/base/operation.js +1 -1
- package/lib/cjs/base/operation.js.map +1 -1
- package/lib/cjs/base/operations/invoke_host_function.js +2 -2
- package/lib/cjs/base/operations/invoke_host_function.js.map +1 -1
- package/lib/cjs/base/operations/revoke_sponsorship.js.map +1 -1
- package/lib/cjs/bindings/config.js +4 -4
- package/lib/cjs/bindings/config.js.map +1 -1
- package/lib/cjs/bindings/generator.js +4 -4
- package/lib/cjs/bindings/generator.js.map +1 -1
- package/lib/cjs/bindings/types.js.map +1 -1
- package/lib/cjs/bindings/utils.js +2 -2
- package/lib/cjs/bindings/utils.js.map +1 -1
- package/lib/cjs/bindings/wasm_fetcher.js +2 -2
- package/lib/cjs/bindings/wasm_fetcher.js.map +1 -1
- package/lib/cjs/contract/assembled_transaction.js.map +1 -1
- package/lib/cjs/contract/spec.js +1 -1
- package/lib/cjs/contract/spec.js.map +1 -1
- package/lib/cjs/contract/types.js.map +1 -1
- package/lib/cjs/gateway/gateway_axios_client.js +1 -1
- package/lib/cjs/gateway/server_api.js.map +1 -1
- package/lib/cjs/rpc/api.js.map +1 -1
- package/lib/cjs/rpc/axios.js +1 -1
- package/lib/cjs/rpc/server.js +32 -27
- package/lib/cjs/rpc/server.js.map +1 -1
- package/lib/cjs/webauth/utils.js.map +1 -1
- package/lib/esm/base/contract.d.ts +4 -4
- package/lib/esm/base/contract.js +2 -2
- package/lib/esm/base/contract.js.map +1 -1
- package/lib/esm/base/invocation.d.ts +2 -2
- package/lib/esm/base/invocation.js.map +1 -1
- package/lib/esm/base/numbers/sc_int.d.ts +2 -2
- package/lib/esm/base/numbers/sc_int.js +1 -1
- package/lib/esm/base/numbers/sc_int.js.map +1 -1
- package/lib/esm/base/operation.d.ts +2 -2
- package/lib/esm/base/operation.js +2 -2
- package/lib/esm/base/operation.js.map +1 -1
- package/lib/esm/base/operations/index.d.ts +1 -1
- package/lib/esm/base/operations/invoke_host_function.d.ts +5 -5
- package/lib/esm/base/operations/invoke_host_function.js +2 -2
- package/lib/esm/base/operations/invoke_host_function.js.map +1 -1
- package/lib/esm/base/operations/revoke_sponsorship.d.ts +1 -1
- package/lib/esm/base/operations/revoke_sponsorship.js.map +1 -1
- package/lib/esm/base/operations/types.d.ts +2 -2
- package/lib/esm/bindings/config.js +4 -4
- package/lib/esm/bindings/config.js.map +1 -1
- package/lib/esm/bindings/generator.d.ts +7 -7
- package/lib/esm/bindings/generator.js +4 -4
- package/lib/esm/bindings/generator.js.map +1 -1
- package/lib/esm/bindings/types.d.ts +1 -1
- package/lib/esm/bindings/types.js.map +1 -1
- package/lib/esm/bindings/utils.d.ts +4 -4
- package/lib/esm/bindings/utils.js +2 -2
- package/lib/esm/bindings/utils.js.map +1 -1
- package/lib/esm/bindings/wasm_fetcher.js +2 -2
- package/lib/esm/bindings/wasm_fetcher.js.map +1 -1
- package/lib/esm/contract/assembled_transaction.d.ts +1 -1
- package/lib/esm/contract/assembled_transaction.js.map +1 -1
- package/lib/esm/contract/spec.js +1 -1
- package/lib/esm/contract/spec.js.map +1 -1
- package/lib/esm/contract/types.d.ts +2 -2
- package/lib/esm/contract/types.js.map +1 -1
- package/lib/esm/gateway/gateway_axios_client.js +1 -1
- package/lib/esm/gateway/server_api.d.ts +2 -2
- package/lib/esm/gateway/server_api.js.map +1 -1
- package/lib/esm/rpc/api.d.ts +1 -1
- package/lib/esm/rpc/api.js.map +1 -1
- package/lib/esm/rpc/axios.js +1 -1
- package/lib/esm/rpc/browser.d.ts +1 -1
- package/lib/esm/rpc/server.d.ts +26 -26
- package/lib/esm/rpc/server.js +32 -27
- package/lib/esm/rpc/server.js.map +1 -1
- package/lib/esm/webauth/utils.d.ts +2 -2
- package/lib/esm/webauth/utils.js.map +1 -1
- package/package.json +41 -39
package/lib/esm/rpc/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sources":["../../../src/rpc/api.ts"],"sourcesContent":["import { Contract, SorobanDataBuilder, xdr } from \"../base/index.js\";\n\n/* tslint:disable-next-line:no-namespace */\nexport namespace Api {\n export interface GetHealthResponse {\n latestLedger: number;\n ledgerRetentionWindow: number;\n oldestLedger: number;\n status: \"healthy\";\n }\n\n export interface LedgerEntryResult {\n lastModifiedLedgerSeq?: number;\n key: xdr.LedgerKey;\n val: xdr.LedgerEntryData;\n liveUntilLedgerSeq?: number;\n }\n\n export interface RawLedgerEntryResult {\n lastModifiedLedgerSeq?: number;\n /** a base-64 encoded {@link xdr.LedgerKey} instance */\n key: string;\n /** a base-64 encoded {@link xdr.LedgerEntryData} instance */\n xdr: string;\n /**\n * optional, a future ledger number upon which this entry will expire\n * based on https://github.com/stellar/soroban-tools/issues/1010\n */\n liveUntilLedgerSeq?: number;\n }\n\n /** An XDR-parsed version of {@link RawLedgerEntryResult} */\n export interface GetLedgerEntriesResponse {\n entries: LedgerEntryResult[];\n latestLedger: number;\n }\n\n /** @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgerEntries */\n export interface RawGetLedgerEntriesResponse {\n entries?: RawLedgerEntryResult[];\n latestLedger: number;\n }\n\n /** @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getNetwork */\n export interface GetNetworkResponse {\n friendbotUrl?: string;\n passphrase: string;\n protocolVersion: string;\n }\n\n /** @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLatestLedger */\n export interface GetLatestLedgerResponse {\n id: string;\n sequence: number;\n protocolVersion: string;\n closeTime: string;\n headerXdr: xdr.LedgerHeader;\n metadataXdr: xdr.LedgerCloseMeta;\n }\n\n export interface RawGetLatestLedgerResponse {\n id: string;\n sequence: number;\n protocolVersion: string;\n closeTime: string;\n /** a base-64 encoded {@link xdr.LedgerHeader} instance */\n headerXdr: string;\n /** a base-64 encoded {@link xdr.LedgerCloseMeta} instance */\n metadataXdr: string;\n }\n\n export enum GetTransactionStatus {\n SUCCESS = \"SUCCESS\",\n NOT_FOUND = \"NOT_FOUND\",\n FAILED = \"FAILED\",\n }\n\n /** @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getTransaction */\n export type GetTransactionResponse =\n | GetSuccessfulTransactionResponse\n | GetFailedTransactionResponse\n | GetMissingTransactionResponse;\n\n interface GetAnyTransactionResponse {\n status: GetTransactionStatus;\n txHash: string;\n latestLedger: number;\n latestLedgerCloseTime: number;\n oldestLedger: number;\n oldestLedgerCloseTime: number;\n }\n\n export interface GetMissingTransactionResponse extends GetAnyTransactionResponse {\n status: GetTransactionStatus.NOT_FOUND;\n }\n\n export interface GetFailedTransactionResponse extends GetAnyTransactionResponse {\n status: GetTransactionStatus.FAILED;\n\n ledger: number;\n createdAt: number;\n applicationOrder: number;\n feeBump: boolean;\n envelopeXdr: xdr.TransactionEnvelope;\n resultXdr: xdr.TransactionResult;\n resultMetaXdr: xdr.TransactionMeta;\n diagnosticEventsXdr?: xdr.DiagnosticEvent[];\n events: TransactionEvents;\n }\n\n export interface GetSuccessfulTransactionResponse extends GetAnyTransactionResponse {\n status: GetTransactionStatus.SUCCESS;\n\n ledger: number;\n createdAt: number;\n applicationOrder: number;\n feeBump: boolean;\n envelopeXdr: xdr.TransactionEnvelope;\n resultXdr: xdr.TransactionResult;\n resultMetaXdr: xdr.TransactionMeta;\n diagnosticEventsXdr?: xdr.DiagnosticEvent[];\n\n returnValue?: xdr.ScVal; // present iff resultMeta is a v3|v4\n events: TransactionEvents;\n }\n\n export interface RawGetTransactionResponse {\n status: GetTransactionStatus;\n latestLedger: number;\n latestLedgerCloseTime: number;\n oldestLedger: number;\n oldestLedgerCloseTime: number;\n txHash: string;\n\n // the fields below are set if status is SUCCESS\n applicationOrder?: number;\n feeBump?: boolean;\n ledger?: number;\n createdAt?: number;\n\n envelopeXdr?: string;\n resultXdr?: string;\n resultMetaXdr?: string;\n diagnosticEventsXdr?: string[];\n\n events?: RawTransactionEvents;\n }\n\n export type GetTransactionsRequest =\n | {\n startLedger: number;\n pagination?: {\n cursor?: never;\n limit?: number;\n };\n }\n | {\n startLedger?: never;\n pagination: {\n cursor: string;\n limit?: number;\n };\n };\n\n export interface RawTransactionEvents {\n transactionEventsXdr?: string[];\n contractEventsXdr?: string[][];\n }\n\n export interface RawTransactionInfo {\n status: GetTransactionStatus;\n ledger: number;\n createdAt: number;\n applicationOrder: number;\n feeBump: boolean;\n txHash: string;\n\n envelopeXdr?: string;\n resultXdr?: string;\n resultMetaXdr?: string;\n diagnosticEventsXdr?: string[];\n\n events?: RawTransactionEvents;\n }\n\n export interface TransactionEvents {\n transactionEventsXdr: xdr.TransactionEvent[];\n contractEventsXdr: xdr.ContractEvent[][];\n }\n\n export interface TransactionInfo {\n status: GetTransactionStatus;\n ledger: number;\n createdAt: number;\n applicationOrder: number;\n feeBump: boolean;\n txHash: string;\n\n envelopeXdr: xdr.TransactionEnvelope;\n resultXdr: xdr.TransactionResult;\n resultMetaXdr: xdr.TransactionMeta;\n returnValue?: xdr.ScVal;\n diagnosticEventsXdr?: xdr.DiagnosticEvent[];\n\n events: TransactionEvents;\n }\n\n export interface GetTransactionsResponse {\n transactions: TransactionInfo[];\n latestLedger: number;\n latestLedgerCloseTimestamp: number;\n oldestLedger: number;\n oldestLedgerCloseTimestamp: number;\n cursor: string;\n }\n\n export interface RawGetTransactionsResponse {\n transactions: RawTransactionInfo[] | null;\n latestLedger: number;\n latestLedgerCloseTimestamp: number;\n oldestLedger: number;\n oldestLedgerCloseTimestamp: number;\n cursor: string;\n }\n\n export type EventType = \"contract\" | \"system\";\n\n export interface EventFilter {\n type?: EventType;\n contractIds?: string[];\n topics?: string[][];\n }\n\n interface RetentionState {\n latestLedger: number;\n oldestLedger: number;\n latestLedgerCloseTime: string;\n oldestLedgerCloseTime: string;\n }\n\n /**\n * Request parameters for fetching events from the Stellar network.\n *\n * **Important**: This type enforces mutually exclusive pagination modes:\n * - **Ledger range mode**: Use `startLedger` and `endLedger` (cursor must be omitted)\n * - **Cursor pagination mode**: Use `cursor` (startLedger and endLedger must be omitted)\n *\n * @example\n * ```ts\n * // ✅ Correct: Ledger range mode\n * const rangeRequest: GetEventsRequest = {\n * filters: [],\n * startLedger: 1000,\n * endLedger: 2000,\n * limit: 100\n * };\n * ```\n *\n * @example\n * ```ts\n * // ✅ Correct: Cursor pagination mode\n * const cursorRequest: GetEventsRequest = {\n * filters: [],\n * cursor: \"some-cursor-value\",\n * limit: 100\n * };\n * ```\n *\n * @example\n * ```ts\n * // ❌ Invalid: Cannot mix cursor with ledger range\n * const invalidRequest = {\n * filters: [],\n * startLedger: 1000, // ❌ Cannot use with cursor\n * endLedger: 2000, // ❌ Cannot use with cursor\n * cursor: \"cursor\", // ❌ Cannot use with ledger range\n * limit: 100\n * };\n * ```\n *\n * @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getEvents | getEvents API reference}\n */\n export type GetEventsRequest =\n | {\n filters: Api.EventFilter[];\n startLedger: number;\n endLedger?: number;\n cursor?: never; // explicitly exclude cursor\n limit?: number;\n }\n | {\n filters: Api.EventFilter[];\n cursor: string;\n startLedger?: never; // explicitly exclude startLedger\n endLedger?: never; // explicitly exclude endLedger\n limit?: number;\n };\n\n export interface GetEventsResponse extends RetentionState {\n events: EventResponse[];\n cursor: string;\n }\n\n export interface EventResponse extends BaseEventResponse {\n contractId?: Contract;\n topic: xdr.ScVal[];\n value: xdr.ScVal;\n }\n\n export interface RawGetEventsResponse extends RetentionState {\n events: RawEventResponse[];\n cursor: string;\n }\n\n interface BaseEventResponse {\n id: string;\n type: EventType;\n ledger: number;\n ledgerClosedAt: string;\n transactionIndex: number;\n operationIndex: number;\n inSuccessfulContractCall: boolean;\n txHash: string;\n }\n\n export interface RawEventResponse extends BaseEventResponse {\n contractId: string;\n topic?: string[];\n value: string;\n }\n\n interface RawLedgerEntryChange {\n type: number;\n /** This is LedgerKey in base64 */\n key: string;\n /** This is xdr.LedgerEntry in base64 */\n before: string | null;\n /** This is xdr.LedgerEntry in base64 */\n after: string | null;\n }\n\n export interface LedgerEntryChange {\n type: number;\n key: xdr.LedgerKey;\n before: xdr.LedgerEntry | null;\n after: xdr.LedgerEntry | null;\n }\n\n export type SendTransactionStatus =\n | \"PENDING\"\n | \"DUPLICATE\"\n | \"TRY_AGAIN_LATER\"\n | \"ERROR\";\n\n export interface SendTransactionResponse extends BaseSendTransactionResponse {\n errorResult?: xdr.TransactionResult;\n diagnosticEvents?: xdr.DiagnosticEvent[];\n }\n\n export interface RawSendTransactionResponse extends BaseSendTransactionResponse {\n /**\n * This is a base64-encoded instance of {@link xdr.TransactionResult}, set\n * only when `status` is `\"ERROR\"`.\n *\n * It contains details on why the network rejected the transaction.\n */\n errorResultXdr?: string;\n /**\n * This is a base64-encoded instance of an array of\n * {@link xdr.DiagnosticEvent}s, set only when `status` is `\"ERROR\"` and\n * diagnostic events are enabled on the server.\n */\n diagnosticEventsXdr?: string[];\n }\n\n export interface BaseSendTransactionResponse {\n status: SendTransactionStatus;\n hash: string;\n latestLedger: number;\n latestLedgerCloseTime: number;\n }\n\n export interface SimulateHostFunctionResult {\n auth: xdr.SorobanAuthorizationEntry[];\n retval: xdr.ScVal;\n }\n\n export type SimulationAuthMode =\n | \"enforce\"\n | \"record\"\n | \"record_allow_nonroot\";\n\n /**\n * Simplifies {@link RawSimulateTransactionResponse} into separate interfaces\n * based on status:\n * - on success, this includes all fields, though `result` is only present\n * if an invocation was simulated (since otherwise there's nothing to\n * \"resultify\")\n * - if there was an expiration error, this includes error and restoration\n * fields\n * - for all other errors, this only includes error fields\n *\n * @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/simulateTransaction\n */\n export type SimulateTransactionResponse =\n | SimulateTransactionSuccessResponse\n | SimulateTransactionRestoreResponse\n | SimulateTransactionErrorResponse;\n\n export interface BaseSimulateTransactionResponse {\n /** always present: the JSON-RPC request ID */\n id: string;\n\n /** always present: the LCL known to the server when responding */\n latestLedger: number;\n\n /**\n * The field is always present, but may be empty in cases where:\n * - you didn't simulate an invocation or\n * - there were no events\n */\n events: xdr.DiagnosticEvent[];\n\n /** a private field to mark the schema as parsed */\n _parsed: boolean;\n }\n\n /** Includes simplified fields only present on success. */\n export interface SimulateTransactionSuccessResponse extends BaseSimulateTransactionResponse {\n transactionData: SorobanDataBuilder;\n minResourceFee: string;\n\n /** present only for invocation simulation */\n result?: SimulateHostFunctionResult;\n\n /** State Difference information */\n stateChanges?: LedgerEntryChange[];\n }\n\n /** Includes details about why the simulation failed */\n export interface SimulateTransactionErrorResponse extends BaseSimulateTransactionResponse {\n error: string;\n events: xdr.DiagnosticEvent[];\n }\n\n export interface SimulateTransactionRestoreResponse extends SimulateTransactionSuccessResponse {\n result: SimulateHostFunctionResult; // not optional now\n\n /**\n * Indicates that a restoration is necessary prior to submission.\n *\n * In other words, seeing a restoration preamble means that your invocation\n * was executed AS IF the required ledger entries were present, and this\n * field includes information about what you need to restore for the\n * simulation to succeed.\n */\n restorePreamble: {\n minResourceFee: string;\n transactionData: SorobanDataBuilder;\n };\n }\n\n /**\n * Checks if a simulation response indicates an error.\n * @param sim - The simulation response to check.\n * @returns True if the response indicates an error, false otherwise.\n */\n export function isSimulationError(\n sim: SimulateTransactionResponse,\n ): sim is SimulateTransactionErrorResponse {\n return \"error\" in sim;\n }\n\n /**\n * Checks if a simulation response indicates success.\n * @param sim - The simulation response to check.\n * @returns True if the response indicates success, false otherwise.\n */\n export function isSimulationSuccess(\n sim: SimulateTransactionResponse,\n ): sim is SimulateTransactionSuccessResponse {\n return \"transactionData\" in sim;\n }\n\n /**\n * Checks if a simulation response indicates that a restoration is needed.\n * @param sim - The simulation response to check.\n * @returns True if the response indicates a restoration is needed, false otherwise.\n */\n export function isSimulationRestore(\n sim: SimulateTransactionResponse,\n ): sim is SimulateTransactionRestoreResponse {\n return (\n isSimulationSuccess(sim) &&\n \"restorePreamble\" in sim &&\n !!sim.restorePreamble.transactionData\n );\n }\n\n /**\n * Checks if a simulation response is in raw (unparsed) form.\n * @param sim - The simulation response to check.\n * @returns True if the response is raw, false otherwise.\n */\n export function isSimulationRaw(\n sim: Api.SimulateTransactionResponse | Api.RawSimulateTransactionResponse,\n ): sim is Api.RawSimulateTransactionResponse {\n return !(sim as Api.SimulateTransactionResponse)._parsed;\n }\n\n interface RawSimulateHostFunctionResult {\n // each string is SorobanAuthorizationEntry XDR in base64\n auth?: string[];\n // invocation return value: the ScVal in base64\n xdr: string;\n }\n\n /** @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/simulateTransaction */\n export interface RawSimulateTransactionResponse {\n id: string;\n latestLedger: number;\n error?: string;\n /** This is an xdr.SorobanTransactionData in base64 */\n transactionData?: string;\n /** These are xdr.DiagnosticEvents in base64 */\n events?: string[];\n minResourceFee?: string;\n /**\n * This will only contain a single element if present, because only a single\n * invokeHostFunctionOperation is supported per transaction.\n * */\n results?: RawSimulateHostFunctionResult[];\n /** Present if succeeded but has expired ledger entries */\n restorePreamble?: {\n minResourceFee: string;\n transactionData: string;\n };\n\n /** State difference information */\n stateChanges?: RawLedgerEntryChange[];\n }\n\n export interface GetVersionInfoResponse {\n version: string;\n commitHash: string;\n buildTimestamp: string;\n captiveCoreVersion: string;\n protocolVersion: number; // uint32\n\n /// @deprecated\n commit_hash: string;\n /// @deprecated\n build_timestamp: string;\n /// @deprecated\n captive_core_version: string;\n /// @deprecated\n protocol_version: number; // uint32\n }\n\n export interface GetFeeStatsResponse {\n sorobanInclusionFee: FeeDistribution;\n inclusionFee: FeeDistribution;\n latestLedger: number; // uint32\n }\n\n interface FeeDistribution {\n max: string; // uint64\n min: string; // uint64\n mode: string; // uint64\n p10: string; // uint64\n p20: string; // uint64\n p30: string; // uint64\n p40: string; // uint64\n p50: string; // uint64\n p60: string; // uint64\n p70: string; // uint64\n p80: string; // uint64\n p90: string; // uint64\n p95: string; // uint64\n p99: string; // uint64\n\n transactionCount: string; // uint32\n ledgerCount: number; // uint32\n }\n\n export interface BalanceResponse {\n latestLedger: number;\n /** present only on success, otherwise request malformed or no balance */\n balanceEntry?: {\n /** a 64-bit integer for trustlines, 128-bit value for contracts */\n amount: string;\n authorized: boolean;\n clawback: boolean;\n authorizedToMaintainLiabilities?: boolean; // only present for trustlines\n /** @deprecated Please use `authorizedToMaintainLiabilities` instead */\n revocable?: boolean;\n lastModifiedLedgerSeq?: number;\n liveUntilLedgerSeq?: number;\n };\n }\n\n /**\n * Request parameters for fetching a sequential list of ledgers.\n *\n * This type supports two distinct pagination modes that are mutually exclusive:\n * - **Ledger-based pagination**: Use `startLedger` to begin fetching from a specific ledger sequence\n * - **Cursor-based pagination**: Use `cursor` to continue from a previous response's pagination token\n *\n * @example\n * ```ts\n * // Ledger-based pagination - start from specific ledger\n * const ledgerRequest: GetLedgersRequest = {\n * startLedger: 36233,\n * pagination: {\n * limit: 10\n * }\n * };\n * ```\n *\n * @example\n * ```ts\n * // Cursor-based pagination - continue from previous response\n * const cursorRequest: GetLedgersRequest = {\n * pagination: {\n * cursor: \"36234\",\n * limit: 5\n * }\n * };\n * ```\n *\n * @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgers | getLedgers API reference}\n */\n export type GetLedgersRequest =\n | {\n /**\n * Ledger sequence number to start fetching from (inclusive).\n * Must be omitted if cursor is provided. Cannot be less than the oldest ledger or greater\n * than the latest ledger stored on the RPC node.\n */\n startLedger: number;\n /** Pagination configuration for the request. */\n pagination?: {\n cursor?: never;\n /**\n * Maximum number of ledgers to return per page.\n * Valid range: 1-10000. Defaults to 100 if not specified.\n */\n limit?: number;\n };\n }\n | {\n startLedger?: never;\n /** Pagination configuration for the request. */\n pagination: {\n /**\n * Page cursor for continuing pagination from a previous\n * response. Must be omitted if startLedger is provided.\n */\n cursor: string;\n /**\n * Maximum number of ledgers to return per page.\n * Valid range: 1-10000. Defaults to 100 if not specified.\n */\n limit?: number;\n };\n };\n\n /** @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgers */\n export interface GetLedgersResponse {\n ledgers: LedgerResponse[];\n latestLedger: number;\n latestLedgerCloseTime: number;\n oldestLedger: number;\n oldestLedgerCloseTime: number;\n cursor: string;\n }\n\n export interface RawGetLedgersResponse {\n ledgers: RawLedgerResponse[];\n latestLedger: number;\n latestLedgerCloseTime: number;\n oldestLedger: number;\n oldestLedgerCloseTime: number;\n cursor: string;\n }\n\n export interface LedgerResponse {\n hash: string;\n sequence: number;\n ledgerCloseTime: string;\n headerXdr: xdr.LedgerHeaderHistoryEntry;\n metadataXdr: xdr.LedgerCloseMeta;\n }\n\n export interface RawLedgerResponse {\n hash: string;\n sequence: number;\n ledgerCloseTime: string;\n /** a base-64 encoded {@link xdr.LedgerHeaderHistoryEntry} instance */\n headerXdr: string;\n /** a base-64 encoded {@link xdr.LedgerCloseMeta} instance */\n metadataXdr: string;\n }\n}\n"],"names":["Api","GetTransactionStatus"],"mappings":"AAGO,IAAU;AAAA,CAAV,CAAUA,IAAAA,KAAV;AAoEE,EAAA,CAAA,CAAKC,qBAAAA,KAAL;AACL,IAAAA,sBAAA,SAAA,CAAA,GAAU,SAAA;AACV,IAAAA,sBAAA,WAAA,CAAA,GAAY,WAAA;AACZ,IAAAA,sBAAA,QAAA,CAAA,GAAS,QAAA;AAAA,EAAA,CAAA,EAHCD,IAAAA,CAAA,oBAAA,KAAAA,IAAAA,CAAA,oBAAA,GAAA,EAAA,CAAA,CAAA;AA4YL,EAAA,SAAS,kBACd,GAAA,EACyC;AACzC,IAAA,OAAO,OAAA,IAAW,GAAA;AAAA,EACpB;AAJO,EAAAA,IAAAA,CAAS,iBAAA,GAAA,iBAAA;AAWT,EAAA,SAAS,oBACd,GAAA,EAC2C;AAC3C,IAAA,OAAO,iBAAA,IAAqB,GAAA;AAAA,EAC9B;AAJO,EAAAA,IAAAA,CAAS,mBAAA,GAAA,mBAAA;AAWT,EAAA,SAAS,oBACd,GAAA,EAC2C;AAC3C,IAAA,OACE,mBAAA,CAAoB,GAAG,CAAA,IACvB,iBAAA,IAAqB,OACrB,CAAC,CAAC,IAAI,eAAA,CAAgB,eAAA;AAAA,EAE1B;AARO,EAAAA,IAAAA,CAAS,mBAAA,GAAA,mBAAA;AAeT,EAAA,SAAS,gBACd,GAAA,EAC2C;AAC3C,IAAA,OAAO,CAAE,GAAA,CAAwC,OAAA;AAAA,EACnD;AAJO,EAAAA,IAAAA,CAAS,eAAA,GAAA,eAAA;AAAA,CAAA,EArfD,GAAA,KAAA,GAAA,GAAA,EAAA,CAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"api.js","sources":["../../../src/rpc/api.ts"],"sourcesContent":["import { Contract, SorobanDataBuilder, xdr } from \"../base/index.js\";\n\n/* tslint:disable-next-line:no-namespace */\nexport namespace Api {\n export interface GetHealthResponse {\n latestLedger: number;\n ledgerRetentionWindow: number;\n oldestLedger: number;\n status: \"healthy\";\n }\n\n export interface LedgerEntryResult {\n lastModifiedLedgerSeq?: number;\n key: xdr.LedgerKey;\n val: xdr.LedgerEntryData;\n liveUntilLedgerSeq?: number;\n }\n\n export interface RawLedgerEntryResult {\n lastModifiedLedgerSeq?: number;\n /** a base-64 encoded {@link xdr.LedgerKey} instance */\n key: string;\n /** a base-64 encoded {@link xdr.LedgerEntryData} instance */\n xdr: string;\n /**\n * optional, a future ledger number upon which this entry will expire\n * based on https://github.com/stellar/soroban-tools/issues/1010\n */\n liveUntilLedgerSeq?: number;\n }\n\n /** An XDR-parsed version of {@link RawLedgerEntryResult} */\n export interface GetLedgerEntriesResponse {\n entries: LedgerEntryResult[];\n latestLedger: number;\n }\n\n /** @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgerEntries */\n export interface RawGetLedgerEntriesResponse {\n entries?: RawLedgerEntryResult[];\n latestLedger: number;\n }\n\n /** @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getNetwork */\n export interface GetNetworkResponse {\n friendbotUrl?: string;\n passphrase: string;\n protocolVersion: string;\n }\n\n /** @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLatestLedger */\n export interface GetLatestLedgerResponse {\n id: string;\n sequence: number;\n protocolVersion: string;\n closeTime: string;\n headerXdr: xdr.LedgerHeader;\n metadataXdr: xdr.LedgerCloseMeta;\n }\n\n export interface RawGetLatestLedgerResponse {\n id: string;\n sequence: number;\n protocolVersion: string;\n closeTime: string;\n /** a base-64 encoded {@link xdr.LedgerHeader} instance */\n headerXdr: string;\n /** a base-64 encoded {@link xdr.LedgerCloseMeta} instance */\n metadataXdr: string;\n }\n\n export enum GetTransactionStatus {\n SUCCESS = \"SUCCESS\",\n NOT_FOUND = \"NOT_FOUND\",\n FAILED = \"FAILED\",\n }\n\n /** @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getTransaction */\n export type GetTransactionResponse =\n | GetSuccessfulTransactionResponse\n | GetFailedTransactionResponse\n | GetMissingTransactionResponse;\n\n interface GetAnyTransactionResponse {\n status: GetTransactionStatus;\n txHash: string;\n latestLedger: number;\n latestLedgerCloseTime: number;\n oldestLedger: number;\n oldestLedgerCloseTime: number;\n }\n\n export interface GetMissingTransactionResponse extends GetAnyTransactionResponse {\n status: GetTransactionStatus.NOT_FOUND;\n }\n\n export interface GetFailedTransactionResponse extends GetAnyTransactionResponse {\n status: GetTransactionStatus.FAILED;\n\n ledger: number;\n createdAt: number;\n applicationOrder: number;\n feeBump: boolean;\n envelopeXdr: xdr.TransactionEnvelope;\n resultXdr: xdr.TransactionResult;\n resultMetaXdr: xdr.TransactionMeta;\n diagnosticEventsXdr?: xdr.DiagnosticEvent[];\n events: TransactionEvents;\n }\n\n export interface GetSuccessfulTransactionResponse extends GetAnyTransactionResponse {\n status: GetTransactionStatus.SUCCESS;\n\n ledger: number;\n createdAt: number;\n applicationOrder: number;\n feeBump: boolean;\n envelopeXdr: xdr.TransactionEnvelope;\n resultXdr: xdr.TransactionResult;\n resultMetaXdr: xdr.TransactionMeta;\n diagnosticEventsXdr?: xdr.DiagnosticEvent[];\n\n returnValue?: xdr.ScVal; // present iff resultMeta is a v3|v4\n events: TransactionEvents;\n }\n\n export interface RawGetTransactionResponse {\n status: GetTransactionStatus;\n latestLedger: number;\n latestLedgerCloseTime: number;\n oldestLedger: number;\n oldestLedgerCloseTime: number;\n txHash: string;\n\n // the fields below are set if status is SUCCESS\n applicationOrder?: number;\n feeBump?: boolean;\n ledger?: number;\n createdAt?: number;\n\n envelopeXdr?: string;\n resultXdr?: string;\n resultMetaXdr?: string;\n diagnosticEventsXdr?: string[];\n\n events?: RawTransactionEvents;\n }\n\n export type GetTransactionsRequest =\n | {\n startLedger: number;\n pagination?: {\n cursor?: never;\n limit?: number;\n };\n }\n | {\n startLedger?: never;\n pagination: {\n cursor: string;\n limit?: number;\n };\n };\n\n export interface RawTransactionEvents {\n transactionEventsXdr?: string[];\n contractEventsXdr?: string[][];\n }\n\n export interface RawTransactionInfo {\n status: GetTransactionStatus;\n ledger: number;\n createdAt: number;\n applicationOrder: number;\n feeBump: boolean;\n txHash: string;\n\n envelopeXdr?: string;\n resultXdr?: string;\n resultMetaXdr?: string;\n diagnosticEventsXdr?: string[];\n\n events?: RawTransactionEvents;\n }\n\n export interface TransactionEvents {\n transactionEventsXdr: xdr.TransactionEvent[];\n contractEventsXdr: xdr.ContractEvent[][];\n }\n\n export interface TransactionInfo {\n status: GetTransactionStatus;\n ledger: number;\n createdAt: number;\n applicationOrder: number;\n feeBump: boolean;\n txHash: string;\n\n envelopeXdr: xdr.TransactionEnvelope;\n resultXdr: xdr.TransactionResult;\n resultMetaXdr: xdr.TransactionMeta;\n returnValue?: xdr.ScVal;\n diagnosticEventsXdr?: xdr.DiagnosticEvent[];\n\n events: TransactionEvents;\n }\n\n export interface GetTransactionsResponse {\n transactions: TransactionInfo[];\n latestLedger: number;\n latestLedgerCloseTimestamp: number;\n oldestLedger: number;\n oldestLedgerCloseTimestamp: number;\n cursor: string;\n }\n\n export interface RawGetTransactionsResponse {\n transactions: RawTransactionInfo[] | null;\n latestLedger: number;\n latestLedgerCloseTimestamp: number;\n oldestLedger: number;\n oldestLedgerCloseTimestamp: number;\n cursor: string;\n }\n\n export type EventType = \"contract\" | \"system\";\n\n export interface EventFilter {\n type?: EventType;\n contractIds?: string[];\n topics?: string[][];\n }\n\n interface RetentionState {\n latestLedger: number;\n oldestLedger: number;\n latestLedgerCloseTime: string;\n oldestLedgerCloseTime: string;\n }\n\n /**\n * Request parameters for fetching events from the Digital World network.\n *\n * **Important**: This type enforces mutually exclusive pagination modes:\n * - **Ledger range mode**: Use `startLedger` and `endLedger` (cursor must be omitted)\n * - **Cursor pagination mode**: Use `cursor` (startLedger and endLedger must be omitted)\n *\n * @example\n * ```ts\n * // ✅ Correct: Ledger range mode\n * const rangeRequest: GetEventsRequest = {\n * filters: [],\n * startLedger: 1000,\n * endLedger: 2000,\n * limit: 100\n * };\n * ```\n *\n * @example\n * ```ts\n * // ✅ Correct: Cursor pagination mode\n * const cursorRequest: GetEventsRequest = {\n * filters: [],\n * cursor: \"some-cursor-value\",\n * limit: 100\n * };\n * ```\n *\n * @example\n * ```ts\n * // ❌ Invalid: Cannot mix cursor with ledger range\n * const invalidRequest = {\n * filters: [],\n * startLedger: 1000, // ❌ Cannot use with cursor\n * endLedger: 2000, // ❌ Cannot use with cursor\n * cursor: \"cursor\", // ❌ Cannot use with ledger range\n * limit: 100\n * };\n * ```\n *\n * @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getEvents | getEvents API reference}\n */\n export type GetEventsRequest =\n | {\n filters: Api.EventFilter[];\n startLedger: number;\n endLedger?: number;\n cursor?: never; // explicitly exclude cursor\n limit?: number;\n }\n | {\n filters: Api.EventFilter[];\n cursor: string;\n startLedger?: never; // explicitly exclude startLedger\n endLedger?: never; // explicitly exclude endLedger\n limit?: number;\n };\n\n export interface GetEventsResponse extends RetentionState {\n events: EventResponse[];\n cursor: string;\n }\n\n export interface EventResponse extends BaseEventResponse {\n contractId?: Contract;\n topic: xdr.ScVal[];\n value: xdr.ScVal;\n }\n\n export interface RawGetEventsResponse extends RetentionState {\n events: RawEventResponse[];\n cursor: string;\n }\n\n interface BaseEventResponse {\n id: string;\n type: EventType;\n ledger: number;\n ledgerClosedAt: string;\n transactionIndex: number;\n operationIndex: number;\n inSuccessfulContractCall: boolean;\n txHash: string;\n }\n\n export interface RawEventResponse extends BaseEventResponse {\n contractId: string;\n topic?: string[];\n value: string;\n }\n\n interface RawLedgerEntryChange {\n type: number;\n /** This is LedgerKey in base64 */\n key: string;\n /** This is xdr.LedgerEntry in base64 */\n before: string | null;\n /** This is xdr.LedgerEntry in base64 */\n after: string | null;\n }\n\n export interface LedgerEntryChange {\n type: number;\n key: xdr.LedgerKey;\n before: xdr.LedgerEntry | null;\n after: xdr.LedgerEntry | null;\n }\n\n export type SendTransactionStatus =\n | \"PENDING\"\n | \"DUPLICATE\"\n | \"TRY_AGAIN_LATER\"\n | \"ERROR\";\n\n export interface SendTransactionResponse extends BaseSendTransactionResponse {\n errorResult?: xdr.TransactionResult;\n diagnosticEvents?: xdr.DiagnosticEvent[];\n }\n\n export interface RawSendTransactionResponse extends BaseSendTransactionResponse {\n /**\n * This is a base64-encoded instance of {@link xdr.TransactionResult}, set\n * only when `status` is `\"ERROR\"`.\n *\n * It contains details on why the network rejected the transaction.\n */\n errorResultXdr?: string;\n /**\n * This is a base64-encoded instance of an array of\n * {@link xdr.DiagnosticEvent}s, set only when `status` is `\"ERROR\"` and\n * diagnostic events are enabled on the server.\n */\n diagnosticEventsXdr?: string[];\n }\n\n export interface BaseSendTransactionResponse {\n status: SendTransactionStatus;\n hash: string;\n latestLedger: number;\n latestLedgerCloseTime: number;\n }\n\n export interface SimulateHostFunctionResult {\n auth: xdr.SorobanAuthorizationEntry[];\n retval: xdr.ScVal;\n }\n\n export type SimulationAuthMode =\n | \"enforce\"\n | \"record\"\n | \"record_allow_nonroot\";\n\n /**\n * Simplifies {@link RawSimulateTransactionResponse} into separate interfaces\n * based on status:\n * - on success, this includes all fields, though `result` is only present\n * if an invocation was simulated (since otherwise there's nothing to\n * \"resultify\")\n * - if there was an expiration error, this includes error and restoration\n * fields\n * - for all other errors, this only includes error fields\n *\n * @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/simulateTransaction\n */\n export type SimulateTransactionResponse =\n | SimulateTransactionSuccessResponse\n | SimulateTransactionRestoreResponse\n | SimulateTransactionErrorResponse;\n\n export interface BaseSimulateTransactionResponse {\n /** always present: the JSON-RPC request ID */\n id: string;\n\n /** always present: the LCL known to the server when responding */\n latestLedger: number;\n\n /**\n * The field is always present, but may be empty in cases where:\n * - you didn't simulate an invocation or\n * - there were no events\n */\n events: xdr.DiagnosticEvent[];\n\n /** a private field to mark the schema as parsed */\n _parsed: boolean;\n }\n\n /** Includes simplified fields only present on success. */\n export interface SimulateTransactionSuccessResponse extends BaseSimulateTransactionResponse {\n transactionData: SorobanDataBuilder;\n minResourceFee: string;\n\n /** present only for invocation simulation */\n result?: SimulateHostFunctionResult;\n\n /** State Difference information */\n stateChanges?: LedgerEntryChange[];\n }\n\n /** Includes details about why the simulation failed */\n export interface SimulateTransactionErrorResponse extends BaseSimulateTransactionResponse {\n error: string;\n events: xdr.DiagnosticEvent[];\n }\n\n export interface SimulateTransactionRestoreResponse extends SimulateTransactionSuccessResponse {\n result: SimulateHostFunctionResult; // not optional now\n\n /**\n * Indicates that a restoration is necessary prior to submission.\n *\n * In other words, seeing a restoration preamble means that your invocation\n * was executed AS IF the required ledger entries were present, and this\n * field includes information about what you need to restore for the\n * simulation to succeed.\n */\n restorePreamble: {\n minResourceFee: string;\n transactionData: SorobanDataBuilder;\n };\n }\n\n /**\n * Checks if a simulation response indicates an error.\n * @param sim - The simulation response to check.\n * @returns True if the response indicates an error, false otherwise.\n */\n export function isSimulationError(\n sim: SimulateTransactionResponse,\n ): sim is SimulateTransactionErrorResponse {\n return \"error\" in sim;\n }\n\n /**\n * Checks if a simulation response indicates success.\n * @param sim - The simulation response to check.\n * @returns True if the response indicates success, false otherwise.\n */\n export function isSimulationSuccess(\n sim: SimulateTransactionResponse,\n ): sim is SimulateTransactionSuccessResponse {\n return \"transactionData\" in sim;\n }\n\n /**\n * Checks if a simulation response indicates that a restoration is needed.\n * @param sim - The simulation response to check.\n * @returns True if the response indicates a restoration is needed, false otherwise.\n */\n export function isSimulationRestore(\n sim: SimulateTransactionResponse,\n ): sim is SimulateTransactionRestoreResponse {\n return (\n isSimulationSuccess(sim) &&\n \"restorePreamble\" in sim &&\n !!sim.restorePreamble.transactionData\n );\n }\n\n /**\n * Checks if a simulation response is in raw (unparsed) form.\n * @param sim - The simulation response to check.\n * @returns True if the response is raw, false otherwise.\n */\n export function isSimulationRaw(\n sim: Api.SimulateTransactionResponse | Api.RawSimulateTransactionResponse,\n ): sim is Api.RawSimulateTransactionResponse {\n return !(sim as Api.SimulateTransactionResponse)._parsed;\n }\n\n interface RawSimulateHostFunctionResult {\n // each string is SorobanAuthorizationEntry XDR in base64\n auth?: string[];\n // invocation return value: the ScVal in base64\n xdr: string;\n }\n\n /** @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/simulateTransaction */\n export interface RawSimulateTransactionResponse {\n id: string;\n latestLedger: number;\n error?: string;\n /** This is an xdr.SorobanTransactionData in base64 */\n transactionData?: string;\n /** These are xdr.DiagnosticEvents in base64 */\n events?: string[];\n minResourceFee?: string;\n /**\n * This will only contain a single element if present, because only a single\n * invokeHostFunctionOperation is supported per transaction.\n * */\n results?: RawSimulateHostFunctionResult[];\n /** Present if succeeded but has expired ledger entries */\n restorePreamble?: {\n minResourceFee: string;\n transactionData: string;\n };\n\n /** State difference information */\n stateChanges?: RawLedgerEntryChange[];\n }\n\n export interface GetVersionInfoResponse {\n version: string;\n commitHash: string;\n buildTimestamp: string;\n captiveCoreVersion: string;\n protocolVersion: number; // uint32\n\n /// @deprecated\n commit_hash: string;\n /// @deprecated\n build_timestamp: string;\n /// @deprecated\n captive_core_version: string;\n /// @deprecated\n protocol_version: number; // uint32\n }\n\n export interface GetFeeStatsResponse {\n sorobanInclusionFee: FeeDistribution;\n inclusionFee: FeeDistribution;\n latestLedger: number; // uint32\n }\n\n interface FeeDistribution {\n max: string; // uint64\n min: string; // uint64\n mode: string; // uint64\n p10: string; // uint64\n p20: string; // uint64\n p30: string; // uint64\n p40: string; // uint64\n p50: string; // uint64\n p60: string; // uint64\n p70: string; // uint64\n p80: string; // uint64\n p90: string; // uint64\n p95: string; // uint64\n p99: string; // uint64\n\n transactionCount: string; // uint32\n ledgerCount: number; // uint32\n }\n\n export interface BalanceResponse {\n latestLedger: number;\n /** present only on success, otherwise request malformed or no balance */\n balanceEntry?: {\n /** a 64-bit integer for trustlines, 128-bit value for contracts */\n amount: string;\n authorized: boolean;\n clawback: boolean;\n authorizedToMaintainLiabilities?: boolean; // only present for trustlines\n /** @deprecated Please use `authorizedToMaintainLiabilities` instead */\n revocable?: boolean;\n lastModifiedLedgerSeq?: number;\n liveUntilLedgerSeq?: number;\n };\n }\n\n /**\n * Request parameters for fetching a sequential list of ledgers.\n *\n * This type supports two distinct pagination modes that are mutually exclusive:\n * - **Ledger-based pagination**: Use `startLedger` to begin fetching from a specific ledger sequence\n * - **Cursor-based pagination**: Use `cursor` to continue from a previous response's pagination token\n *\n * @example\n * ```ts\n * // Ledger-based pagination - start from specific ledger\n * const ledgerRequest: GetLedgersRequest = {\n * startLedger: 36233,\n * pagination: {\n * limit: 10\n * }\n * };\n * ```\n *\n * @example\n * ```ts\n * // Cursor-based pagination - continue from previous response\n * const cursorRequest: GetLedgersRequest = {\n * pagination: {\n * cursor: \"36234\",\n * limit: 5\n * }\n * };\n * ```\n *\n * @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgers | getLedgers API reference}\n */\n export type GetLedgersRequest =\n | {\n /**\n * Ledger sequence number to start fetching from (inclusive).\n * Must be omitted if cursor is provided. Cannot be less than the oldest ledger or greater\n * than the latest ledger stored on the RPC node.\n */\n startLedger: number;\n /** Pagination configuration for the request. */\n pagination?: {\n cursor?: never;\n /**\n * Maximum number of ledgers to return per page.\n * Valid range: 1-10000. Defaults to 100 if not specified.\n */\n limit?: number;\n };\n }\n | {\n startLedger?: never;\n /** Pagination configuration for the request. */\n pagination: {\n /**\n * Page cursor for continuing pagination from a previous\n * response. Must be omitted if startLedger is provided.\n */\n cursor: string;\n /**\n * Maximum number of ledgers to return per page.\n * Valid range: 1-10000. Defaults to 100 if not specified.\n */\n limit?: number;\n };\n };\n\n /** @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgers */\n export interface GetLedgersResponse {\n ledgers: LedgerResponse[];\n latestLedger: number;\n latestLedgerCloseTime: number;\n oldestLedger: number;\n oldestLedgerCloseTime: number;\n cursor: string;\n }\n\n export interface RawGetLedgersResponse {\n ledgers: RawLedgerResponse[];\n latestLedger: number;\n latestLedgerCloseTime: number;\n oldestLedger: number;\n oldestLedgerCloseTime: number;\n cursor: string;\n }\n\n export interface LedgerResponse {\n hash: string;\n sequence: number;\n ledgerCloseTime: string;\n headerXdr: xdr.LedgerHeaderHistoryEntry;\n metadataXdr: xdr.LedgerCloseMeta;\n }\n\n export interface RawLedgerResponse {\n hash: string;\n sequence: number;\n ledgerCloseTime: string;\n /** a base-64 encoded {@link xdr.LedgerHeaderHistoryEntry} instance */\n headerXdr: string;\n /** a base-64 encoded {@link xdr.LedgerCloseMeta} instance */\n metadataXdr: string;\n }\n}\n"],"names":["Api","GetTransactionStatus"],"mappings":"AAGO,IAAU;AAAA,CAAV,CAAUA,IAAAA,KAAV;AAoEE,EAAA,CAAA,CAAKC,qBAAAA,KAAL;AACL,IAAAA,sBAAA,SAAA,CAAA,GAAU,SAAA;AACV,IAAAA,sBAAA,WAAA,CAAA,GAAY,WAAA;AACZ,IAAAA,sBAAA,QAAA,CAAA,GAAS,QAAA;AAAA,EAAA,CAAA,EAHCD,IAAAA,CAAA,oBAAA,KAAAA,IAAAA,CAAA,oBAAA,GAAA,EAAA,CAAA,CAAA;AA4YL,EAAA,SAAS,kBACd,GAAA,EACyC;AACzC,IAAA,OAAO,OAAA,IAAW,GAAA;AAAA,EACpB;AAJO,EAAAA,IAAAA,CAAS,iBAAA,GAAA,iBAAA;AAWT,EAAA,SAAS,oBACd,GAAA,EAC2C;AAC3C,IAAA,OAAO,iBAAA,IAAqB,GAAA;AAAA,EAC9B;AAJO,EAAAA,IAAAA,CAAS,mBAAA,GAAA,mBAAA;AAWT,EAAA,SAAS,oBACd,GAAA,EAC2C;AAC3C,IAAA,OACE,mBAAA,CAAoB,GAAG,CAAA,IACvB,iBAAA,IAAqB,OACrB,CAAC,CAAC,IAAI,eAAA,CAAgB,eAAA;AAAA,EAE1B;AARO,EAAAA,IAAAA,CAAS,mBAAA,GAAA,mBAAA;AAeT,EAAA,SAAS,gBACd,GAAA,EAC2C;AAC3C,IAAA,OAAO,CAAE,GAAA,CAAwC,OAAA;AAAA,EACnD;AAJO,EAAAA,IAAAA,CAAS,eAAA,GAAA,eAAA;AAAA,CAAA,EArfD,GAAA,KAAA,GAAA,GAAA,EAAA,CAAA,CAAA;;;;"}
|
package/lib/esm/rpc/axios.js
CHANGED
package/lib/esm/rpc/browser.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from "./index.js";
|
|
2
|
-
export * as
|
|
2
|
+
export * as DigitalWorldBase from "../base/index.js";
|
package/lib/esm/rpc/server.d.ts
CHANGED
|
@@ -87,7 +87,7 @@ export declare class RpcServer {
|
|
|
87
87
|
readonly httpClient: HttpClient;
|
|
88
88
|
constructor(serverURL: string, opts?: RpcServer.Options);
|
|
89
89
|
/**
|
|
90
|
-
* Fetch a minimal set of current info about a
|
|
90
|
+
* Fetch a minimal set of current info about a Digital World account.
|
|
91
91
|
*
|
|
92
92
|
* Needed to get the current sequence number for the account so you can build
|
|
93
93
|
* a successful transaction with {@link TransactionBuilder}.
|
|
@@ -108,7 +108,7 @@ export declare class RpcServer {
|
|
|
108
108
|
*/
|
|
109
109
|
getAccount(address: string): Promise<Account>;
|
|
110
110
|
/**
|
|
111
|
-
* Fetch the full account entry for a
|
|
111
|
+
* Fetch the full account entry for a Digital World account.
|
|
112
112
|
*
|
|
113
113
|
* @param address - The public address of the account to load.
|
|
114
114
|
* @returns Resolves to the full on-chain account
|
|
@@ -127,7 +127,7 @@ export declare class RpcServer {
|
|
|
127
127
|
*/
|
|
128
128
|
getAccountEntry(address: string): Promise<xdr.AccountEntry>;
|
|
129
129
|
/**
|
|
130
|
-
* Fetch the full trustline entry for a
|
|
130
|
+
* Fetch the full trustline entry for a Digital World account.
|
|
131
131
|
*
|
|
132
132
|
* @param account - The public address of the account whose trustline it is
|
|
133
133
|
* @param asset - The trustline's asset
|
|
@@ -152,7 +152,7 @@ export declare class RpcServer {
|
|
|
152
152
|
*/
|
|
153
153
|
getTrustline(account: string, asset: Asset): Promise<xdr.TrustLineEntry>;
|
|
154
154
|
/**
|
|
155
|
-
* Fetch the full claimable balance entry for a
|
|
155
|
+
* Fetch the full claimable balance entry for a Digital World account.
|
|
156
156
|
*
|
|
157
157
|
* @param id - The strkey (`B...`) or hex (`00000000abcde...`) (both
|
|
158
158
|
* IDs with and without the 000... version prefix are accepted) of the
|
|
@@ -535,15 +535,15 @@ export declare class RpcServer {
|
|
|
535
535
|
* @example
|
|
536
536
|
* ```ts
|
|
537
537
|
* const contractId = 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE';
|
|
538
|
-
* const contract = new
|
|
538
|
+
* const contract = new DigitalWorldSdk.Contract(contractId);
|
|
539
539
|
*
|
|
540
540
|
* // Right now, this is just the default fee for this example.
|
|
541
|
-
* const fee =
|
|
542
|
-
* const transaction = new
|
|
541
|
+
* const fee = DigitalWorldSdk.BASE_FEE;
|
|
542
|
+
* const transaction = new DigitalWorldSdk.TransactionBuilder(account, { fee })
|
|
543
543
|
* // Uncomment the following line to build transactions for the live network. Be
|
|
544
544
|
* // sure to also change the horizon hostname.
|
|
545
|
-
* //.setNetworkPassphrase(
|
|
546
|
-
* .setNetworkPassphrase(
|
|
545
|
+
* //.setNetworkPassphrase(DigitalWorldSdk.Networks.PUBLIC)
|
|
546
|
+
* .setNetworkPassphrase(DigitalWorldSdk.Networks.FUTURENET)
|
|
547
547
|
* .setTimeout(30) // valid for the next 30s
|
|
548
548
|
* // Add an operation to call increment() on the contract
|
|
549
549
|
* .addOperation(contract.call("increment"))
|
|
@@ -600,15 +600,15 @@ export declare class RpcServer {
|
|
|
600
600
|
* @example
|
|
601
601
|
* ```ts
|
|
602
602
|
* const contractId = 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE';
|
|
603
|
-
* const contract = new
|
|
603
|
+
* const contract = new DigitalWorldSdk.Contract(contractId);
|
|
604
604
|
*
|
|
605
605
|
* // Right now, this is just the default fee for this example.
|
|
606
|
-
* const fee =
|
|
607
|
-
* const transaction = new
|
|
606
|
+
* const fee = DigitalWorldSdk.BASE_FEE;
|
|
607
|
+
* const transaction = new DigitalWorldSdk.TransactionBuilder(account, { fee })
|
|
608
608
|
* // Uncomment the following line to build transactions for the live network. Be
|
|
609
609
|
* // sure to also change the horizon hostname.
|
|
610
|
-
* //.setNetworkPassphrase(
|
|
611
|
-
* .setNetworkPassphrase(
|
|
610
|
+
* //.setNetworkPassphrase(DigitalWorldSdk.Networks.PUBLIC)
|
|
611
|
+
* .setNetworkPassphrase(DigitalWorldSdk.Networks.FUTURENET)
|
|
612
612
|
* .setTimeout(30) // valid for the next 30s
|
|
613
613
|
* // Add an operation to call increment() on the contract
|
|
614
614
|
* .addOperation(contract.call("increment"))
|
|
@@ -619,8 +619,8 @@ export declare class RpcServer {
|
|
|
619
619
|
* // Sign this transaction with the secret key
|
|
620
620
|
* // NOTE: signing is transaction is network specific. Test network transactions
|
|
621
621
|
* // won't work in the public network. To switch networks, use the Network object
|
|
622
|
-
* // as explained above (look for
|
|
623
|
-
* const sourceKeypair =
|
|
622
|
+
* // as explained above (look for DigitalWorldSdk.Network).
|
|
623
|
+
* const sourceKeypair = DigitalWorldSdk.Keypair.fromSecret(sourceSecretKey);
|
|
624
624
|
* preparedTransaction.sign(sourceKeypair);
|
|
625
625
|
*
|
|
626
626
|
* server.sendTransaction(transaction).then(result => {
|
|
@@ -632,7 +632,7 @@ export declare class RpcServer {
|
|
|
632
632
|
*/
|
|
633
633
|
prepareTransaction(tx: Transaction | FeeBumpTransaction): Promise<Transaction>;
|
|
634
634
|
/**
|
|
635
|
-
* Submit a real transaction to the
|
|
635
|
+
* Submit a real transaction to the Digital World network.
|
|
636
636
|
*
|
|
637
637
|
* Unlike Horizon, RPC does not wait for transaction completion. It
|
|
638
638
|
* simply validates the transaction and enqueues it. Clients should call
|
|
@@ -649,15 +649,15 @@ export declare class RpcServer {
|
|
|
649
649
|
* @example
|
|
650
650
|
* ```ts
|
|
651
651
|
* const contractId = 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE';
|
|
652
|
-
* const contract = new
|
|
652
|
+
* const contract = new DigitalWorldSdk.Contract(contractId);
|
|
653
653
|
*
|
|
654
654
|
* // Right now, this is just the default fee for this example.
|
|
655
|
-
* const fee =
|
|
656
|
-
* const transaction = new
|
|
655
|
+
* const fee = DigitalWorldSdk.BASE_FEE;
|
|
656
|
+
* const transaction = new DigitalWorldSdk.TransactionBuilder(account, { fee })
|
|
657
657
|
* // Uncomment the following line to build transactions for the live network. Be
|
|
658
658
|
* // sure to also change the horizon hostname.
|
|
659
|
-
* //.setNetworkPassphrase(
|
|
660
|
-
* .setNetworkPassphrase(
|
|
659
|
+
* //.setNetworkPassphrase(DigitalWorldSdk.Networks.PUBLIC)
|
|
660
|
+
* .setNetworkPassphrase(DigitalWorldSdk.Networks.FUTURENET)
|
|
661
661
|
* .setTimeout(30) // valid for the next 30s
|
|
662
662
|
* // Add an operation to call increment() on the contract
|
|
663
663
|
* .addOperation(contract.call("increment"))
|
|
@@ -666,8 +666,8 @@ export declare class RpcServer {
|
|
|
666
666
|
* // Sign this transaction with the secret key
|
|
667
667
|
* // NOTE: signing is transaction is network specific. Test network transactions
|
|
668
668
|
* // won't work in the public network. To switch networks, use the Network object
|
|
669
|
-
* // as explained above (look for
|
|
670
|
-
* const sourceKeypair =
|
|
669
|
+
* // as explained above (look for DigitalWorldSdk.Network).
|
|
670
|
+
* const sourceKeypair = DigitalWorldSdk.Keypair.fromSecret(sourceSecretKey);
|
|
671
671
|
* transaction.sign(sourceKeypair);
|
|
672
672
|
*
|
|
673
673
|
* server.sendTransaction(transaction).then((result) => {
|
|
@@ -716,10 +716,10 @@ export declare class RpcServer {
|
|
|
716
716
|
*
|
|
717
717
|
* This method supports both account (G...) and contract (C...) addresses.
|
|
718
718
|
*
|
|
719
|
-
* @param address - The address to fund. Can be either a
|
|
719
|
+
* @param address - The address to fund. Can be either a Digital World
|
|
720
720
|
* account (G...) or contract (C...) address.
|
|
721
721
|
* @param faucetUrl - (optional) Optionally, an explicit faucet URL
|
|
722
|
-
* (by default: this calls the
|
|
722
|
+
* (by default: this calls the Digital World RPC
|
|
723
723
|
* {@link rpc.Server.getNetwork | getNetwork} method to try to
|
|
724
724
|
* discover this network's faucet url).
|
|
725
725
|
* @returns The transaction
|
package/lib/esm/rpc/server.js
CHANGED
|
@@ -88,7 +88,7 @@ class RpcServer {
|
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
/**
|
|
91
|
-
* Fetch a minimal set of current info about a
|
|
91
|
+
* Fetch a minimal set of current info about a Digital World account.
|
|
92
92
|
*
|
|
93
93
|
* Needed to get the current sequence number for the account so you can build
|
|
94
94
|
* a successful transaction with {@link TransactionBuilder}.
|
|
@@ -112,7 +112,7 @@ class RpcServer {
|
|
|
112
112
|
return new Account(address, entry.seqNum().toString());
|
|
113
113
|
}
|
|
114
114
|
/**
|
|
115
|
-
* Fetch the full account entry for a
|
|
115
|
+
* Fetch the full account entry for a Digital World account.
|
|
116
116
|
*
|
|
117
117
|
* @param address - The public address of the account to load.
|
|
118
118
|
* @returns Resolves to the full on-chain account
|
|
@@ -143,7 +143,7 @@ class RpcServer {
|
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
/**
|
|
146
|
-
* Fetch the full trustline entry for a
|
|
146
|
+
* Fetch the full trustline entry for a Digital World account.
|
|
147
147
|
*
|
|
148
148
|
* @param account - The public address of the account whose trustline it is
|
|
149
149
|
* @param asset - The trustline's asset
|
|
@@ -183,7 +183,7 @@ class RpcServer {
|
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
/**
|
|
186
|
-
* Fetch the full claimable balance entry for a
|
|
186
|
+
* Fetch the full claimable balance entry for a Digital World account.
|
|
187
187
|
*
|
|
188
188
|
* @param id - The strkey (`B...`) or hex (`00000000abcde...`) (both
|
|
189
189
|
* IDs with and without the 000... version prefix are accepted) of the
|
|
@@ -813,15 +813,15 @@ class RpcServer {
|
|
|
813
813
|
* @example
|
|
814
814
|
* ```ts
|
|
815
815
|
* const contractId = 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE';
|
|
816
|
-
* const contract = new
|
|
816
|
+
* const contract = new DigitalWorldSdk.Contract(contractId);
|
|
817
817
|
*
|
|
818
818
|
* // Right now, this is just the default fee for this example.
|
|
819
|
-
* const fee =
|
|
820
|
-
* const transaction = new
|
|
819
|
+
* const fee = DigitalWorldSdk.BASE_FEE;
|
|
820
|
+
* const transaction = new DigitalWorldSdk.TransactionBuilder(account, { fee })
|
|
821
821
|
* // Uncomment the following line to build transactions for the live network. Be
|
|
822
822
|
* // sure to also change the horizon hostname.
|
|
823
|
-
* //.setNetworkPassphrase(
|
|
824
|
-
* .setNetworkPassphrase(
|
|
823
|
+
* //.setNetworkPassphrase(DigitalWorldSdk.Networks.PUBLIC)
|
|
824
|
+
* .setNetworkPassphrase(DigitalWorldSdk.Networks.FUTURENET)
|
|
825
825
|
* .setTimeout(30) // valid for the next 30s
|
|
826
826
|
* // Add an operation to call increment() on the contract
|
|
827
827
|
* .addOperation(contract.call("increment"))
|
|
@@ -897,15 +897,15 @@ class RpcServer {
|
|
|
897
897
|
* @example
|
|
898
898
|
* ```ts
|
|
899
899
|
* const contractId = 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE';
|
|
900
|
-
* const contract = new
|
|
900
|
+
* const contract = new DigitalWorldSdk.Contract(contractId);
|
|
901
901
|
*
|
|
902
902
|
* // Right now, this is just the default fee for this example.
|
|
903
|
-
* const fee =
|
|
904
|
-
* const transaction = new
|
|
903
|
+
* const fee = DigitalWorldSdk.BASE_FEE;
|
|
904
|
+
* const transaction = new DigitalWorldSdk.TransactionBuilder(account, { fee })
|
|
905
905
|
* // Uncomment the following line to build transactions for the live network. Be
|
|
906
906
|
* // sure to also change the horizon hostname.
|
|
907
|
-
* //.setNetworkPassphrase(
|
|
908
|
-
* .setNetworkPassphrase(
|
|
907
|
+
* //.setNetworkPassphrase(DigitalWorldSdk.Networks.PUBLIC)
|
|
908
|
+
* .setNetworkPassphrase(DigitalWorldSdk.Networks.FUTURENET)
|
|
909
909
|
* .setTimeout(30) // valid for the next 30s
|
|
910
910
|
* // Add an operation to call increment() on the contract
|
|
911
911
|
* .addOperation(contract.call("increment"))
|
|
@@ -916,8 +916,8 @@ class RpcServer {
|
|
|
916
916
|
* // Sign this transaction with the secret key
|
|
917
917
|
* // NOTE: signing is transaction is network specific. Test network transactions
|
|
918
918
|
* // won't work in the public network. To switch networks, use the Network object
|
|
919
|
-
* // as explained above (look for
|
|
920
|
-
* const sourceKeypair =
|
|
919
|
+
* // as explained above (look for DigitalWorldSdk.Network).
|
|
920
|
+
* const sourceKeypair = DigitalWorldSdk.Keypair.fromSecret(sourceSecretKey);
|
|
921
921
|
* preparedTransaction.sign(sourceKeypair);
|
|
922
922
|
*
|
|
923
923
|
* server.sendTransaction(transaction).then(result => {
|
|
@@ -935,7 +935,7 @@ class RpcServer {
|
|
|
935
935
|
return assembleTransaction(tx, simResponse).build();
|
|
936
936
|
}
|
|
937
937
|
/**
|
|
938
|
-
* Submit a real transaction to the
|
|
938
|
+
* Submit a real transaction to the Digital World network.
|
|
939
939
|
*
|
|
940
940
|
* Unlike Horizon, RPC does not wait for transaction completion. It
|
|
941
941
|
* simply validates the transaction and enqueues it. Clients should call
|
|
@@ -952,15 +952,15 @@ class RpcServer {
|
|
|
952
952
|
* @example
|
|
953
953
|
* ```ts
|
|
954
954
|
* const contractId = 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE';
|
|
955
|
-
* const contract = new
|
|
955
|
+
* const contract = new DigitalWorldSdk.Contract(contractId);
|
|
956
956
|
*
|
|
957
957
|
* // Right now, this is just the default fee for this example.
|
|
958
|
-
* const fee =
|
|
959
|
-
* const transaction = new
|
|
958
|
+
* const fee = DigitalWorldSdk.BASE_FEE;
|
|
959
|
+
* const transaction = new DigitalWorldSdk.TransactionBuilder(account, { fee })
|
|
960
960
|
* // Uncomment the following line to build transactions for the live network. Be
|
|
961
961
|
* // sure to also change the horizon hostname.
|
|
962
|
-
* //.setNetworkPassphrase(
|
|
963
|
-
* .setNetworkPassphrase(
|
|
962
|
+
* //.setNetworkPassphrase(DigitalWorldSdk.Networks.PUBLIC)
|
|
963
|
+
* .setNetworkPassphrase(DigitalWorldSdk.Networks.FUTURENET)
|
|
964
964
|
* .setTimeout(30) // valid for the next 30s
|
|
965
965
|
* // Add an operation to call increment() on the contract
|
|
966
966
|
* .addOperation(contract.call("increment"))
|
|
@@ -969,8 +969,8 @@ class RpcServer {
|
|
|
969
969
|
* // Sign this transaction with the secret key
|
|
970
970
|
* // NOTE: signing is transaction is network specific. Test network transactions
|
|
971
971
|
* // won't work in the public network. To switch networks, use the Network object
|
|
972
|
-
* // as explained above (look for
|
|
973
|
-
* const sourceKeypair =
|
|
972
|
+
* // as explained above (look for DigitalWorldSdk.Network).
|
|
973
|
+
* const sourceKeypair = DigitalWorldSdk.Keypair.fromSecret(sourceSecretKey);
|
|
974
974
|
* transaction.sign(sourceKeypair);
|
|
975
975
|
*
|
|
976
976
|
* server.sendTransaction(transaction).then((result) => {
|
|
@@ -1026,6 +1026,11 @@ class RpcServer {
|
|
|
1026
1026
|
*/
|
|
1027
1027
|
async requestAirdrop(address, faucetUrl) {
|
|
1028
1028
|
const account = typeof address === "string" ? address : address.accountId();
|
|
1029
|
+
if (!StrKey.isValidEd25519PublicKey(account) && !StrKey.isValidContract(account)) {
|
|
1030
|
+
throw new Error(
|
|
1031
|
+
`Invalid address: ${account}. Expected a Digital World account (G...) or contract (C...) address.`
|
|
1032
|
+
);
|
|
1033
|
+
}
|
|
1029
1034
|
faucetUrl = faucetUrl || (await this.getNetwork()).friendbotUrl;
|
|
1030
1035
|
if (!faucetUrl) {
|
|
1031
1036
|
throw new Error("No faucet URL configured for current network");
|
|
@@ -1063,10 +1068,10 @@ class RpcServer {
|
|
|
1063
1068
|
*
|
|
1064
1069
|
* This method supports both account (G...) and contract (C...) addresses.
|
|
1065
1070
|
*
|
|
1066
|
-
* @param address - The address to fund. Can be either a
|
|
1071
|
+
* @param address - The address to fund. Can be either a Digital World
|
|
1067
1072
|
* account (G...) or contract (C...) address.
|
|
1068
1073
|
* @param faucetUrl - (optional) Optionally, an explicit faucet URL
|
|
1069
|
-
* (by default: this calls the
|
|
1074
|
+
* (by default: this calls the Digital World RPC
|
|
1070
1075
|
* {@link rpc.Server.getNetwork | getNetwork} method to try to
|
|
1071
1076
|
* discover this network's faucet url).
|
|
1072
1077
|
* @returns The transaction
|
|
@@ -1093,7 +1098,7 @@ class RpcServer {
|
|
|
1093
1098
|
async fundAddress(address, faucetUrl) {
|
|
1094
1099
|
if (!StrKey.isValidEd25519PublicKey(address) && !StrKey.isValidContract(address)) {
|
|
1095
1100
|
throw new Error(
|
|
1096
|
-
`Invalid address: ${address}. Expected a
|
|
1101
|
+
`Invalid address: ${address}. Expected a Digital World account (G...) or contract (C...) address.`
|
|
1097
1102
|
);
|
|
1098
1103
|
}
|
|
1099
1104
|
faucetUrl = faucetUrl || (await this.getNetwork()).friendbotUrl;
|