@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/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
`digital-world-js-sdk` is a JavaScript library for communicating with a
|
|
11
11
|
[Digital World Gateway](https://docs.digitalworld.global/docs/data/apis/horizon)
|
|
12
|
-
and [
|
|
12
|
+
and [Soroban RPC](https://docs.digitalworld.global/docs/data/apis/rpc). While
|
|
13
13
|
primarily intended for applications built on Node.js or in the browser, it can
|
|
14
14
|
be adapted for use in other environments with some tinkering.
|
|
15
15
|
|
|
@@ -29,7 +29,7 @@ The library provides:
|
|
|
29
29
|
- [...with React Native](#usage-with-react-native)
|
|
30
30
|
- [...with Expo](#usage-with-expo-managed-workflows)
|
|
31
31
|
- [...with CloudFlare Workers](#usage-with-cloudflare-workers)
|
|
32
|
-
- [CLI](#cli): generate TypeScript bindings for
|
|
32
|
+
- [CLI](#cli): generate TypeScript bindings for Digital World smart contracts
|
|
33
33
|
- [Developing](#developing): contribute to the project!
|
|
34
34
|
- [License](#license)
|
|
35
35
|
|
|
@@ -163,7 +163,7 @@ local branch, run `pnpm docs:llms`; the generated files are written under
|
|
|
163
163
|
You can also refer to:
|
|
164
164
|
|
|
165
165
|
- the [documentation](https://docs.digitalworld.global/docs/data/horizon) for the
|
|
166
|
-
Gateway REST API (if using the `
|
|
166
|
+
Gateway REST API (if using the `Gateway` module) and
|
|
167
167
|
- the [documentation](https://docs.digitalworld.global/docs/data/rpc) for Soroban
|
|
168
168
|
RPC's API (if using the `rpc` module)
|
|
169
169
|
|
|
@@ -224,7 +224,7 @@ are:
|
|
|
224
224
|
## CLI
|
|
225
225
|
|
|
226
226
|
The SDK includes a command-line tool for generating TypeScript bindings from
|
|
227
|
-
|
|
227
|
+
Digital World smart contracts. These bindings provide fully-typed client code with IDE
|
|
228
228
|
autocompletion and compile-time type checking.
|
|
229
229
|
|
|
230
230
|
### Running the CLI
|
|
@@ -313,7 +313,7 @@ npx @digitalworld/digital-world-sdk generate \
|
|
|
313
313
|
| `--wasm <path>` | Path to a local WASM file |
|
|
314
314
|
| `--wasm-hash <hash>` | Hex-encoded hash of WASM blob on the network |
|
|
315
315
|
| `--contract-id <id>` | Contract ID of a deployed contract |
|
|
316
|
-
| `--rpc-url <url>` |
|
|
316
|
+
| `--rpc-url <url>` | Soroban RPC server URL (has defaults for testnet/localnet, required for mainnet) |
|
|
317
317
|
| `--network <network>` | Network to use: `testnet`, `mainnet`, or `localnet` (required for network sources) |
|
|
318
318
|
| `--output-dir <dir>` | Output directory for generated bindings (required) |
|
|
319
319
|
| `--contract-name <name>` | Name for the generated package (derived from filename if not provided) |
|
|
@@ -38913,7 +38913,7 @@
|
|
|
38913
38913
|
...opts.auth !== void 0 && { auth: opts.auth }
|
|
38914
38914
|
});
|
|
38915
38915
|
}
|
|
38916
|
-
function
|
|
38916
|
+
function createDigitalWorldAssetContract(opts) {
|
|
38917
38917
|
let asset = opts.asset;
|
|
38918
38918
|
if (typeof asset === "string") {
|
|
38919
38919
|
const parts = asset.split(":");
|
|
@@ -39291,7 +39291,7 @@
|
|
|
39291
39291
|
static restoreFootprint = restoreFootprint;
|
|
39292
39292
|
// These are not `xdr.Operation`s directly, but proxies for common
|
|
39293
39293
|
// versions of `Operation.invokeHostFunction`
|
|
39294
|
-
static
|
|
39294
|
+
static createDigitalWorldAssetContract = createDigitalWorldAssetContract;
|
|
39295
39295
|
static invokeContractFunction = invokeContractFunction;
|
|
39296
39296
|
static createCustomContract = createCustomContract;
|
|
39297
39297
|
static uploadContractWasm = uploadContractWasm;
|
|
@@ -40362,7 +40362,7 @@
|
|
|
40362
40362
|
}
|
|
40363
40363
|
}
|
|
40364
40364
|
/**
|
|
40365
|
-
* Returns
|
|
40365
|
+
* Returns Digital World contract ID as a strkey, ex.
|
|
40366
40366
|
* `CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE`.
|
|
40367
40367
|
*/
|
|
40368
40368
|
contractId() {
|
|
@@ -40385,7 +40385,7 @@
|
|
|
40385
40385
|
* @see Operation.invokeHostFunction
|
|
40386
40386
|
* @see Operation.invokeContractFunction
|
|
40387
40387
|
* @see Operation.createCustomContract
|
|
40388
|
-
* @see Operation.
|
|
40388
|
+
* @see Operation.createDigitalWorldAssetContract
|
|
40389
40389
|
* @see Operation.uploadContractWasm
|
|
40390
40390
|
*/
|
|
40391
40391
|
call(method, ...params) {
|
|
@@ -40747,7 +40747,7 @@
|
|
|
40747
40747
|
class ScInt extends XdrLargeInt {
|
|
40748
40748
|
/**
|
|
40749
40749
|
* @param value - a single, integer-like value which will
|
|
40750
|
-
* be interpreted in the smallest appropriate XDR type supported by
|
|
40750
|
+
* be interpreted in the smallest appropriate XDR type supported by Digital World
|
|
40751
40751
|
* (64, 128, or 256 bit integer values). signed values are supported, though
|
|
40752
40752
|
* they are sanity-checked against `opts.type`. if you need 32-bit values,
|
|
40753
40753
|
* you can construct them directly without needing this wrapper, e.g.
|
|
@@ -43717,7 +43717,7 @@ ${value}`, dataLines++;
|
|
|
43717
43717
|
return doc && typeof doc == "object" && "baseURI" in doc && typeof doc.baseURI == "string" ? doc.baseURI : void 0;
|
|
43718
43718
|
}
|
|
43719
43719
|
|
|
43720
|
-
const version$1 = "16.0.
|
|
43720
|
+
const version$1 = "16.0.1";
|
|
43721
43721
|
const SERVER_TIME_MAP = {};
|
|
43722
43722
|
function toSeconds(ms) {
|
|
43723
43723
|
return Math.floor(ms / 1e3);
|
|
@@ -45644,7 +45644,7 @@ ${value}`, dataLines++;
|
|
|
45644
45644
|
Api2.isSimulationRaw = isSimulationRaw;
|
|
45645
45645
|
})(Api || (Api = {}));
|
|
45646
45646
|
|
|
45647
|
-
const version = "16.0.
|
|
45647
|
+
const version = "16.0.1";
|
|
45648
45648
|
function createHttpClient(headers) {
|
|
45649
45649
|
return create({
|
|
45650
45650
|
headers: {
|
|
@@ -46015,7 +46015,7 @@ ${value}`, dataLines++;
|
|
|
46015
46015
|
}
|
|
46016
46016
|
}
|
|
46017
46017
|
/**
|
|
46018
|
-
* Fetch a minimal set of current info about a
|
|
46018
|
+
* Fetch a minimal set of current info about a Digital World account.
|
|
46019
46019
|
*
|
|
46020
46020
|
* Needed to get the current sequence number for the account so you can build
|
|
46021
46021
|
* a successful transaction with {@link TransactionBuilder}.
|
|
@@ -46039,7 +46039,7 @@ ${value}`, dataLines++;
|
|
|
46039
46039
|
return new Account(address, entry.seqNum().toString());
|
|
46040
46040
|
}
|
|
46041
46041
|
/**
|
|
46042
|
-
* Fetch the full account entry for a
|
|
46042
|
+
* Fetch the full account entry for a Digital World account.
|
|
46043
46043
|
*
|
|
46044
46044
|
* @param address - The public address of the account to load.
|
|
46045
46045
|
* @returns Resolves to the full on-chain account
|
|
@@ -46070,7 +46070,7 @@ ${value}`, dataLines++;
|
|
|
46070
46070
|
}
|
|
46071
46071
|
}
|
|
46072
46072
|
/**
|
|
46073
|
-
* Fetch the full trustline entry for a
|
|
46073
|
+
* Fetch the full trustline entry for a Digital World account.
|
|
46074
46074
|
*
|
|
46075
46075
|
* @param account - The public address of the account whose trustline it is
|
|
46076
46076
|
* @param asset - The trustline's asset
|
|
@@ -46110,7 +46110,7 @@ ${value}`, dataLines++;
|
|
|
46110
46110
|
}
|
|
46111
46111
|
}
|
|
46112
46112
|
/**
|
|
46113
|
-
* Fetch the full claimable balance entry for a
|
|
46113
|
+
* Fetch the full claimable balance entry for a Digital World account.
|
|
46114
46114
|
*
|
|
46115
46115
|
* @param id - The strkey (`B...`) or hex (`00000000abcde...`) (both
|
|
46116
46116
|
* IDs with and without the 000... version prefix are accepted) of the
|
|
@@ -46740,15 +46740,15 @@ ${value}`, dataLines++;
|
|
|
46740
46740
|
* @example
|
|
46741
46741
|
* ```ts
|
|
46742
46742
|
* const contractId = 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE';
|
|
46743
|
-
* const contract = new
|
|
46743
|
+
* const contract = new DigitalWorldSdk.Contract(contractId);
|
|
46744
46744
|
*
|
|
46745
46745
|
* // Right now, this is just the default fee for this example.
|
|
46746
|
-
* const fee =
|
|
46747
|
-
* const transaction = new
|
|
46746
|
+
* const fee = DigitalWorldSdk.BASE_FEE;
|
|
46747
|
+
* const transaction = new DigitalWorldSdk.TransactionBuilder(account, { fee })
|
|
46748
46748
|
* // Uncomment the following line to build transactions for the live network. Be
|
|
46749
46749
|
* // sure to also change the horizon hostname.
|
|
46750
|
-
* //.setNetworkPassphrase(
|
|
46751
|
-
* .setNetworkPassphrase(
|
|
46750
|
+
* //.setNetworkPassphrase(DigitalWorldSdk.Networks.PUBLIC)
|
|
46751
|
+
* .setNetworkPassphrase(DigitalWorldSdk.Networks.FUTURENET)
|
|
46752
46752
|
* .setTimeout(30) // valid for the next 30s
|
|
46753
46753
|
* // Add an operation to call increment() on the contract
|
|
46754
46754
|
* .addOperation(contract.call("increment"))
|
|
@@ -46824,15 +46824,15 @@ ${value}`, dataLines++;
|
|
|
46824
46824
|
* @example
|
|
46825
46825
|
* ```ts
|
|
46826
46826
|
* const contractId = 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE';
|
|
46827
|
-
* const contract = new
|
|
46827
|
+
* const contract = new DigitalWorldSdk.Contract(contractId);
|
|
46828
46828
|
*
|
|
46829
46829
|
* // Right now, this is just the default fee for this example.
|
|
46830
|
-
* const fee =
|
|
46831
|
-
* const transaction = new
|
|
46830
|
+
* const fee = DigitalWorldSdk.BASE_FEE;
|
|
46831
|
+
* const transaction = new DigitalWorldSdk.TransactionBuilder(account, { fee })
|
|
46832
46832
|
* // Uncomment the following line to build transactions for the live network. Be
|
|
46833
46833
|
* // sure to also change the horizon hostname.
|
|
46834
|
-
* //.setNetworkPassphrase(
|
|
46835
|
-
* .setNetworkPassphrase(
|
|
46834
|
+
* //.setNetworkPassphrase(DigitalWorldSdk.Networks.PUBLIC)
|
|
46835
|
+
* .setNetworkPassphrase(DigitalWorldSdk.Networks.FUTURENET)
|
|
46836
46836
|
* .setTimeout(30) // valid for the next 30s
|
|
46837
46837
|
* // Add an operation to call increment() on the contract
|
|
46838
46838
|
* .addOperation(contract.call("increment"))
|
|
@@ -46843,8 +46843,8 @@ ${value}`, dataLines++;
|
|
|
46843
46843
|
* // Sign this transaction with the secret key
|
|
46844
46844
|
* // NOTE: signing is transaction is network specific. Test network transactions
|
|
46845
46845
|
* // won't work in the public network. To switch networks, use the Network object
|
|
46846
|
-
* // as explained above (look for
|
|
46847
|
-
* const sourceKeypair =
|
|
46846
|
+
* // as explained above (look for DigitalWorldSdk.Network).
|
|
46847
|
+
* const sourceKeypair = DigitalWorldSdk.Keypair.fromSecret(sourceSecretKey);
|
|
46848
46848
|
* preparedTransaction.sign(sourceKeypair);
|
|
46849
46849
|
*
|
|
46850
46850
|
* server.sendTransaction(transaction).then(result => {
|
|
@@ -46862,7 +46862,7 @@ ${value}`, dataLines++;
|
|
|
46862
46862
|
return assembleTransaction(tx, simResponse).build();
|
|
46863
46863
|
}
|
|
46864
46864
|
/**
|
|
46865
|
-
* Submit a real transaction to the
|
|
46865
|
+
* Submit a real transaction to the Digital World network.
|
|
46866
46866
|
*
|
|
46867
46867
|
* Unlike Horizon, RPC does not wait for transaction completion. It
|
|
46868
46868
|
* simply validates the transaction and enqueues it. Clients should call
|
|
@@ -46879,15 +46879,15 @@ ${value}`, dataLines++;
|
|
|
46879
46879
|
* @example
|
|
46880
46880
|
* ```ts
|
|
46881
46881
|
* const contractId = 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE';
|
|
46882
|
-
* const contract = new
|
|
46882
|
+
* const contract = new DigitalWorldSdk.Contract(contractId);
|
|
46883
46883
|
*
|
|
46884
46884
|
* // Right now, this is just the default fee for this example.
|
|
46885
|
-
* const fee =
|
|
46886
|
-
* const transaction = new
|
|
46885
|
+
* const fee = DigitalWorldSdk.BASE_FEE;
|
|
46886
|
+
* const transaction = new DigitalWorldSdk.TransactionBuilder(account, { fee })
|
|
46887
46887
|
* // Uncomment the following line to build transactions for the live network. Be
|
|
46888
46888
|
* // sure to also change the horizon hostname.
|
|
46889
|
-
* //.setNetworkPassphrase(
|
|
46890
|
-
* .setNetworkPassphrase(
|
|
46889
|
+
* //.setNetworkPassphrase(DigitalWorldSdk.Networks.PUBLIC)
|
|
46890
|
+
* .setNetworkPassphrase(DigitalWorldSdk.Networks.FUTURENET)
|
|
46891
46891
|
* .setTimeout(30) // valid for the next 30s
|
|
46892
46892
|
* // Add an operation to call increment() on the contract
|
|
46893
46893
|
* .addOperation(contract.call("increment"))
|
|
@@ -46896,8 +46896,8 @@ ${value}`, dataLines++;
|
|
|
46896
46896
|
* // Sign this transaction with the secret key
|
|
46897
46897
|
* // NOTE: signing is transaction is network specific. Test network transactions
|
|
46898
46898
|
* // won't work in the public network. To switch networks, use the Network object
|
|
46899
|
-
* // as explained above (look for
|
|
46900
|
-
* const sourceKeypair =
|
|
46899
|
+
* // as explained above (look for DigitalWorldSdk.Network).
|
|
46900
|
+
* const sourceKeypair = DigitalWorldSdk.Keypair.fromSecret(sourceSecretKey);
|
|
46901
46901
|
* transaction.sign(sourceKeypair);
|
|
46902
46902
|
*
|
|
46903
46903
|
* server.sendTransaction(transaction).then((result) => {
|
|
@@ -46953,6 +46953,11 @@ ${value}`, dataLines++;
|
|
|
46953
46953
|
*/
|
|
46954
46954
|
async requestAirdrop(address, faucetUrl) {
|
|
46955
46955
|
const account = typeof address === "string" ? address : address.accountId();
|
|
46956
|
+
if (!StrKey.isValidEd25519PublicKey(account) && !StrKey.isValidContract(account)) {
|
|
46957
|
+
throw new Error(
|
|
46958
|
+
`Invalid address: ${account}. Expected a Digital World account (G...) or contract (C...) address.`
|
|
46959
|
+
);
|
|
46960
|
+
}
|
|
46956
46961
|
faucetUrl = faucetUrl || (await this.getNetwork()).friendbotUrl;
|
|
46957
46962
|
if (!faucetUrl) {
|
|
46958
46963
|
throw new Error("No faucet URL configured for current network");
|
|
@@ -46990,10 +46995,10 @@ ${value}`, dataLines++;
|
|
|
46990
46995
|
*
|
|
46991
46996
|
* This method supports both account (G...) and contract (C...) addresses.
|
|
46992
46997
|
*
|
|
46993
|
-
* @param address - The address to fund. Can be either a
|
|
46998
|
+
* @param address - The address to fund. Can be either a Digital World
|
|
46994
46999
|
* account (G...) or contract (C...) address.
|
|
46995
47000
|
* @param faucetUrl - (optional) Optionally, an explicit faucet URL
|
|
46996
|
-
* (by default: this calls the
|
|
47001
|
+
* (by default: this calls the Digital World RPC
|
|
46997
47002
|
* {@link rpc.Server.getNetwork | getNetwork} method to try to
|
|
46998
47003
|
* discover this network's faucet url).
|
|
46999
47004
|
* @returns The transaction
|
|
@@ -47020,7 +47025,7 @@ ${value}`, dataLines++;
|
|
|
47020
47025
|
async fundAddress(address, faucetUrl) {
|
|
47021
47026
|
if (!StrKey.isValidEd25519PublicKey(address) && !StrKey.isValidContract(address)) {
|
|
47022
47027
|
throw new Error(
|
|
47023
|
-
`Invalid address: ${address}. Expected a
|
|
47028
|
+
`Invalid address: ${address}. Expected a Digital World account (G...) or contract (C...) address.`
|
|
47024
47029
|
);
|
|
47025
47030
|
}
|
|
47026
47031
|
faucetUrl = faucetUrl || (await this.getNetwork()).friendbotUrl;
|
|
@@ -48382,7 +48387,7 @@ ${JSON.stringify(sentTransaction)}`
|
|
|
48382
48387
|
MuxedAddress: {
|
|
48383
48388
|
type: "string",
|
|
48384
48389
|
format: "address",
|
|
48385
|
-
description: "
|
|
48390
|
+
description: "Digital World public key with M prefix combining a G address and unique ID"
|
|
48386
48391
|
},
|
|
48387
48392
|
ScString: {
|
|
48388
48393
|
type: "string",
|
|
@@ -49567,13 +49572,13 @@ ${JSON.stringify(sentTransaction)}`
|
|
|
49567
49572
|
if (stellarContractImports.length > 0) {
|
|
49568
49573
|
const uniqueContractImports = Array.from(new Set(stellarContractImports));
|
|
49569
49574
|
importLines.push(
|
|
49570
|
-
`import {${uniqueContractImports.join(", ")}} from '@
|
|
49575
|
+
`import {${uniqueContractImports.join(", ")}} from '@digitalworld/digital-world-sdk/contract';`
|
|
49571
49576
|
);
|
|
49572
49577
|
}
|
|
49573
49578
|
if (stellarImports.length > 0) {
|
|
49574
49579
|
const uniqueStellarImports = Array.from(new Set(stellarImports));
|
|
49575
49580
|
importLines.push(
|
|
49576
|
-
`import {${uniqueStellarImports.join(", ")}} from '@
|
|
49581
|
+
`import {${uniqueStellarImports.join(", ")}} from '@digitalworld/digital-world-sdk';`
|
|
49577
49582
|
);
|
|
49578
49583
|
}
|
|
49579
49584
|
if (imports.needsBufferImport) {
|
|
@@ -49783,7 +49788,7 @@ ${indent} */
|
|
|
49783
49788
|
const generatedPackageJson = {
|
|
49784
49789
|
name: contractName.toLowerCase().replace(/[^a-z0-9-]/g, "-"),
|
|
49785
49790
|
version: "0.0.1",
|
|
49786
|
-
description: `Generated TypeScript bindings for ${contractName}
|
|
49791
|
+
description: `Generated TypeScript bindings for ${contractName} Digital World contract`,
|
|
49787
49792
|
type: "module",
|
|
49788
49793
|
main: "dist/index.js",
|
|
49789
49794
|
types: "dist/index.d.ts",
|
|
@@ -49791,7 +49796,7 @@ ${indent} */
|
|
|
49791
49796
|
build: "tsc"
|
|
49792
49797
|
},
|
|
49793
49798
|
dependencies: {
|
|
49794
|
-
"@stellar/stellar-sdk": `^${"16.0.
|
|
49799
|
+
"@stellar/stellar-sdk": `^${"16.0.1"}`,
|
|
49795
49800
|
buffer: "6.0.3"
|
|
49796
49801
|
},
|
|
49797
49802
|
devDependencies: {
|
|
@@ -49855,7 +49860,7 @@ ${indent} */
|
|
|
49855
49860
|
const readme = [
|
|
49856
49861
|
`# ${contractName} Contract Bindings`,
|
|
49857
49862
|
"",
|
|
49858
|
-
`TypeScript bindings for the ${contractName}
|
|
49863
|
+
`TypeScript bindings for the ${contractName} Digital World smart contract.`,
|
|
49859
49864
|
"",
|
|
49860
49865
|
"## Installation",
|
|
49861
49866
|
"",
|
|
@@ -49892,7 +49897,7 @@ ${indent} */
|
|
|
49892
49897
|
"- `tsconfig.json` - TypeScript configuration",
|
|
49893
49898
|
"- `package.json` - NPM package configuration",
|
|
49894
49899
|
"",
|
|
49895
|
-
"This package was generated using the
|
|
49900
|
+
"This package was generated using the Digital World JS SDK contract binding generator."
|
|
49896
49901
|
].join("\n");
|
|
49897
49902
|
return readme;
|
|
49898
49903
|
}
|
|
@@ -50247,7 +50252,7 @@ export class Client extends ContractClient {
|
|
|
50247
50252
|
throw new WasmFetchError("Failed to fetch WASM from hash", error);
|
|
50248
50253
|
}
|
|
50249
50254
|
}
|
|
50250
|
-
function
|
|
50255
|
+
function isDigitalWorldAssetContract(instance) {
|
|
50251
50256
|
return instance.executable().switch() === types.ContractExecutableType.contractExecutableStellarAsset();
|
|
50252
50257
|
}
|
|
50253
50258
|
async function fetchWasmFromContract(server, contractAddress) {
|
|
@@ -50263,7 +50268,7 @@ export class Client extends ContractClient {
|
|
|
50263
50268
|
}
|
|
50264
50269
|
const contractData = entry.val.contractData();
|
|
50265
50270
|
const instance = contractData.val().instance();
|
|
50266
|
-
if (
|
|
50271
|
+
if (isDigitalWorldAssetContract(instance)) {
|
|
50267
50272
|
return { type: "stellar-asset-contract" };
|
|
50268
50273
|
}
|
|
50269
50274
|
const wasmHash = instance.executable().wasmHash();
|
|
@@ -50364,12 +50369,12 @@ export class Client extends ContractClient {
|
|
|
50364
50369
|
/**
|
|
50365
50370
|
* Creates a BindingGenerator by fetching WASM from the network using its hash.
|
|
50366
50371
|
*
|
|
50367
|
-
* Retrieves the WASM bytecode from
|
|
50372
|
+
* Retrieves the WASM bytecode from Digital World RPC using the WASM hash,
|
|
50368
50373
|
* then parses the contract specification from it. Useful when you know
|
|
50369
50374
|
* the hash of an installed WASM but don't have the binary locally.
|
|
50370
50375
|
*
|
|
50371
50376
|
* @param wasmHash - The hex-encoded hash of the installed WASM blob
|
|
50372
|
-
* @param rpcServer - The
|
|
50377
|
+
* @param rpcServer - The Digital World RPC server instance
|
|
50373
50378
|
* @returns A Promise resolving to a new BindingGenerator instance
|
|
50374
50379
|
* @throws If the WASM cannot be fetched or doesn't contain a valid spec
|
|
50375
50380
|
*
|
|
@@ -50393,11 +50398,11 @@ export class Client extends ContractClient {
|
|
|
50393
50398
|
* Creates a BindingGenerator by fetching contract info from a deployed contract ID.
|
|
50394
50399
|
*
|
|
50395
50400
|
* Retrieves the contract's WASM from the network using the contract ID,
|
|
50396
|
-
* then parses the specification. If the contract is a
|
|
50401
|
+
* then parses the specification. If the contract is a Digital World Asset Contract (SAC),
|
|
50397
50402
|
* returns a generator with the standard SAC specification.
|
|
50398
50403
|
*
|
|
50399
50404
|
* @param contractId - The contract ID (C... address) of the deployed contract
|
|
50400
|
-
* @param rpcServer - The
|
|
50405
|
+
* @param rpcServer - The Digital World RPC server instance
|
|
50401
50406
|
* @returns A Promise resolving to a new BindingGenerator instance
|
|
50402
50407
|
* @throws If the contract cannot be found or fetched
|
|
50403
50408
|
*
|