passkey-kit 0.10.3 → 0.10.5
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/.github/workflows/release.yml +3 -13
- package/cheatsheet.txt +1 -1
- package/package.json +6 -8
- package/packages/passkey-kit-sdk/package.json +2 -2
- package/packages/passkey-kit-sdk/src/index.ts +18 -18
- package/packages/passkey-kit-sdk/types/index.d.ts +15 -7
- package/packages/sac-sdk/package.json +2 -2
- package/packages/sac-sdk/src/index.ts +33 -28
- package/packages/sac-sdk/types/index.d.ts +22 -11
- package/src/index.ts +1 -2
- package/src/kit.ts +47 -44
- package/src/sac.ts +4 -3
- package/src/server.ts +7 -7
- package/types/index.d.ts +0 -1
- package/types/kit.d.ts +8 -10
- package/types/sac.d.ts +1 -1
- package/types/server.d.ts +6 -6
- package/packages/passkey-factory-sdk/README.md +0 -54
- package/packages/passkey-factory-sdk/package.json +0 -18
- package/packages/passkey-factory-sdk/src/index.ts +0 -107
- package/packages/passkey-factory-sdk/tsconfig.json +0 -98
- package/packages/passkey-factory-sdk/types/index.d.ts +0 -94
|
@@ -10,22 +10,12 @@ on:
|
|
|
10
10
|
|
|
11
11
|
jobs:
|
|
12
12
|
|
|
13
|
-
release-contract-
|
|
14
|
-
uses: stellar-expert/soroban-build-workflow/.github/workflows/release.yml@main
|
|
15
|
-
with:
|
|
16
|
-
release_name: ${{ github.ref_name }}
|
|
17
|
-
release_description: 'Release of the factory contract'
|
|
18
|
-
relative_path: 'contracts'
|
|
19
|
-
package: 'webauthn-factory'
|
|
20
|
-
secrets:
|
|
21
|
-
release_token: ${{ secrets.GITHUB_TOKEN }}
|
|
22
|
-
|
|
23
|
-
release-contract-webauthn-secp256r1:
|
|
13
|
+
release-contract-smart-wallet:
|
|
24
14
|
uses: stellar-expert/soroban-build-workflow/.github/workflows/release.yml@main
|
|
25
15
|
with:
|
|
26
16
|
release_name: ${{ github.ref_name }}
|
|
27
|
-
release_description: 'Release of the
|
|
17
|
+
release_description: 'Release of the smart wallet contract'
|
|
28
18
|
relative_path: 'contracts'
|
|
29
|
-
package: '
|
|
19
|
+
package: 'smart-wallet'
|
|
30
20
|
secrets:
|
|
31
21
|
release_token: ${{ secrets.GITHUB_TOKEN }}
|
package/cheatsheet.txt
CHANGED
|
@@ -13,6 +13,6 @@ stellar contract deploy --wasm target/wasm32-unknown-unknown/release/sample_poli
|
|
|
13
13
|
|
|
14
14
|
export JWT=???
|
|
15
15
|
mercury-cli --jwt $JWT --local false --mainnet false deploy
|
|
16
|
-
mercury-cli --jwt $JWT --local false --mainnet false catchup --project-name "smart-wallets-next-dima" --contracts
|
|
16
|
+
mercury-cli --jwt $JWT --local false --mainnet false catchup --project-name "smart-wallets-next-dima" --contracts CBVTK6PLO2P7N47ABXP52SJSHSW3RJRS3SGZHQMLZCQ3SLP36IN3FS7X
|
|
17
17
|
curl -X GET https://api.mercurydata.app/catchups/4
|
|
18
18
|
curl -X POST https://api.mercurydata.app/v2/key -H "Authorization: Bearer $JWT"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "passkey-kit",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.5",
|
|
4
4
|
"description": "A helper library for creating and using smart wallet accounts on the Stellar blockchain.",
|
|
5
5
|
"author": "Tyler van der Hoeven",
|
|
6
6
|
"license": "MIT",
|
|
@@ -12,14 +12,13 @@
|
|
|
12
12
|
"@stellar/stellar-sdk": "^13.0.0",
|
|
13
13
|
"base64url": "^3.0.1",
|
|
14
14
|
"buffer": "^6.0.3",
|
|
15
|
-
"
|
|
16
|
-
"passkey-kit-sdk": "0.6.
|
|
17
|
-
"sac-sdk": "0.3.1"
|
|
15
|
+
"sac-sdk": "0.3.2",
|
|
16
|
+
"passkey-kit-sdk": "0.6.2"
|
|
18
17
|
},
|
|
19
18
|
"devDependencies": {
|
|
20
19
|
"@simplewebauthn/types": "^11.0.0",
|
|
21
|
-
"@types/node": "^22.
|
|
22
|
-
"typescript": "^5.
|
|
20
|
+
"@types/node": "^22.10.1",
|
|
21
|
+
"typescript": "^5.7.2"
|
|
23
22
|
},
|
|
24
23
|
"workspaces": [
|
|
25
24
|
"packages/*"
|
|
@@ -53,9 +52,8 @@
|
|
|
53
52
|
"deploy:demo": "npx wrangler pages deploy",
|
|
54
53
|
"deploy:demo:prod": "npx wrangler pages deploy --env production",
|
|
55
54
|
"build:sac": "pnpm --filter=sac-sdk run build",
|
|
56
|
-
"build:pfs": "pnpm --filter=passkey-factory-sdk run build",
|
|
57
55
|
"build:pks": "pnpm --filter=passkey-kit-sdk run build",
|
|
58
|
-
"build": "pnpm run build:sac && pnpm run build:
|
|
56
|
+
"build": "pnpm run build:sac && pnpm run build:pks && tsc",
|
|
59
57
|
"ext:cp": "./clone-js-sdk.sh"
|
|
60
58
|
}
|
|
61
59
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.6.
|
|
2
|
+
"version": "0.6.2",
|
|
3
3
|
"name": "passkey-kit-sdk",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src/index.ts",
|
|
@@ -13,6 +13,6 @@
|
|
|
13
13
|
"@stellar/stellar-sdk": "13.0.0"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"typescript": "5.
|
|
16
|
+
"typescript": "5.7.2"
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -3,21 +3,12 @@ import {
|
|
|
3
3
|
AssembledTransaction,
|
|
4
4
|
Client as ContractClient,
|
|
5
5
|
ClientOptions as ContractClientOptions,
|
|
6
|
-
|
|
6
|
+
MethodOptions,
|
|
7
7
|
Spec as ContractSpec,
|
|
8
8
|
} from '@stellar/stellar-sdk/minimal/contract';
|
|
9
9
|
import type {
|
|
10
10
|
u32,
|
|
11
|
-
i32,
|
|
12
|
-
u64,
|
|
13
|
-
i64,
|
|
14
|
-
u128,
|
|
15
|
-
i128,
|
|
16
|
-
u256,
|
|
17
|
-
i256,
|
|
18
11
|
Option,
|
|
19
|
-
Typepoint,
|
|
20
|
-
Duration,
|
|
21
12
|
} from '@stellar/stellar-sdk/minimal/contract';
|
|
22
13
|
|
|
23
14
|
if (typeof window !== 'undefined') {
|
|
@@ -25,13 +16,6 @@ if (typeof window !== 'undefined') {
|
|
|
25
16
|
window.Buffer = window.Buffer || Buffer;
|
|
26
17
|
}
|
|
27
18
|
|
|
28
|
-
export const networks = {
|
|
29
|
-
testnet: {
|
|
30
|
-
networkPassphrase: "Test SDF Network ; September 2015",
|
|
31
|
-
contractId: "NIL",
|
|
32
|
-
}
|
|
33
|
-
} as const
|
|
34
|
-
|
|
35
19
|
export const Errors = {
|
|
36
20
|
1: { message: "NotFound" },
|
|
37
21
|
|
|
@@ -60,7 +44,6 @@ export type SignerStorage = { tag: "Persistent", values: void } | { tag: "Tempor
|
|
|
60
44
|
|
|
61
45
|
export type Signer = { tag: "Policy", values: readonly [string, Option<u32>, SignerLimits, SignerStorage] } | { tag: "Ed25519", values: readonly [Buffer, Option<u32>, SignerLimits, SignerStorage] } | { tag: "Secp256r1", values: readonly [Buffer, Buffer, Option<u32>, SignerLimits, SignerStorage] };
|
|
62
46
|
|
|
63
|
-
|
|
64
47
|
export interface Secp256r1Signature {
|
|
65
48
|
authenticator_data: Buffer;
|
|
66
49
|
client_data_json: Buffer;
|
|
@@ -154,6 +137,22 @@ export interface Client {
|
|
|
154
137
|
|
|
155
138
|
}
|
|
156
139
|
export class Client extends ContractClient {
|
|
140
|
+
static async deploy<T = Client>(
|
|
141
|
+
/** Constructor/Initialization Args for the contract's `__constructor` method */
|
|
142
|
+
{ signer }: { signer: Option<Signer> },
|
|
143
|
+
/** Options for initalizing a Client as well as for calling a method, with extras specific to deploying. */
|
|
144
|
+
options: MethodOptions &
|
|
145
|
+
Omit<ContractClientOptions, "contractId"> & {
|
|
146
|
+
/** The hash of the Wasm blob, which must already be installed on-chain. */
|
|
147
|
+
wasmHash: Buffer | string;
|
|
148
|
+
/** Salt used to generate the contract's ID. Passed through to {@link Operation.createCustomContract}. Default: random. */
|
|
149
|
+
salt?: Buffer | Uint8Array;
|
|
150
|
+
/** The format used to decode `wasmHash`, if it's provided as a string. */
|
|
151
|
+
format?: "hex" | "base64";
|
|
152
|
+
}
|
|
153
|
+
): Promise<AssembledTransaction<T>> {
|
|
154
|
+
return ContractClient.deploy({ signer }, options)
|
|
155
|
+
}
|
|
157
156
|
constructor(public readonly options: ContractClientOptions) {
|
|
158
157
|
super(
|
|
159
158
|
new ContractSpec(["AAAABAAAAAAAAAAAAAAABUVycm9yAAAAAAAACQAAAAAAAAAITm90Rm91bmQAAAABAAAAAAAAAA1BbHJlYWR5RXhpc3RzAAAAAAAAAgAAAAAAAAAOTWlzc2luZ0NvbnRleHQAAAAAAAMAAAAAAAAADVNpZ25lckV4cGlyZWQAAAAAAAAEAAAAAAAAABJGYWlsZWRTaWduZXJMaW1pdHMAAAAAAAUAAAAAAAAAGEZhaWxlZFBvbGljeVNpZ25lckxpbWl0cwAAAAYAAAAAAAAAGVNpZ25hdHVyZUtleVZhbHVlTWlzbWF0Y2gAAAAAAAAHAAAAAAAAACBDbGllbnREYXRhSnNvbkNoYWxsZW5nZUluY29ycmVjdAAAAAgAAAAAAAAADkpzb25QYXJzZUVycm9yAAAAAAAJ",
|
|
@@ -165,6 +164,7 @@ export class Client extends ContractClient {
|
|
|
165
164
|
"AAAAAQAAAAAAAAAAAAAAElNlY3AyNTZyMVNpZ25hdHVyZQAAAAAAAwAAAAAAAAASYXV0aGVudGljYXRvcl9kYXRhAAAAAAAOAAAAAAAAABBjbGllbnRfZGF0YV9qc29uAAAADgAAAAAAAAAJc2lnbmF0dXJlAAAAAAAD7gAAAEA=",
|
|
166
165
|
"AAAAAgAAAAAAAAAAAAAACVNpZ25hdHVyZQAAAAAAAAIAAAABAAAAAAAAAAdFZDI1NTE5AAAAAAEAAAPuAAAAQAAAAAEAAAAAAAAACVNlY3AyNTZyMQAAAAAAAAEAAAfQAAAAElNlY3AyNTZyMVNpZ25hdHVyZQAA",
|
|
167
166
|
"AAAAAQAAAAAAAAAAAAAAClNpZ25hdHVyZXMAAAAAAAEAAAAAAAAAATAAAAAAAAPsAAAH0AAAAAlTaWduZXJLZXkAAAAAAAPoAAAH0AAAAAlTaWduYXR1cmUAAAA=",
|
|
167
|
+
"AAAAAAAAAAAAAAANX19jb25zdHJ1Y3RvcgAAAAAAAAEAAAAAAAAABnNpZ25lcgAAAAAD6AAAB9AAAAAGU2lnbmVyAAAAAAAA",
|
|
168
168
|
"AAAAAAAAAAAAAAAKYWRkX3NpZ25lcgAAAAAAAQAAAAAAAAAGc2lnbmVyAAAAAAfQAAAABlNpZ25lcgAAAAAAAA==",
|
|
169
169
|
"AAAAAAAAAAAAAAANdXBkYXRlX3NpZ25lcgAAAAAAAAEAAAAAAAAABnNpZ25lcgAAAAAH0AAAAAZTaWduZXIAAAAAAAA=",
|
|
170
170
|
"AAAAAAAAAAAAAAANcmVtb3ZlX3NpZ25lcgAAAAAAAAEAAAAAAAAACnNpZ25lcl9rZXkAAAAAB9AAAAAJU2lnbmVyS2V5AAAAAAAAAA==",
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { Buffer } from "buffer";
|
|
2
|
-
import { AssembledTransaction, Client as ContractClient, ClientOptions as ContractClientOptions } from '@stellar/stellar-sdk/minimal/contract';
|
|
2
|
+
import { AssembledTransaction, Client as ContractClient, ClientOptions as ContractClientOptions, MethodOptions } from '@stellar/stellar-sdk/minimal/contract';
|
|
3
3
|
import type { u32, Option } from '@stellar/stellar-sdk/minimal/contract';
|
|
4
|
-
export declare const networks: {
|
|
5
|
-
readonly testnet: {
|
|
6
|
-
readonly networkPassphrase: "Test SDF Network ; September 2015";
|
|
7
|
-
readonly contractId: "NIL";
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
4
|
export declare const Errors: {
|
|
11
5
|
1: {
|
|
12
6
|
message: string;
|
|
@@ -167,6 +161,20 @@ export interface Client {
|
|
|
167
161
|
}
|
|
168
162
|
export declare class Client extends ContractClient {
|
|
169
163
|
readonly options: ContractClientOptions;
|
|
164
|
+
static deploy<T = Client>(
|
|
165
|
+
/** Constructor/Initialization Args for the contract's `__constructor` method */
|
|
166
|
+
{ signer }: {
|
|
167
|
+
signer: Option<Signer>;
|
|
168
|
+
},
|
|
169
|
+
/** Options for initalizing a Client as well as for calling a method, with extras specific to deploying. */
|
|
170
|
+
options: MethodOptions & Omit<ContractClientOptions, "contractId"> & {
|
|
171
|
+
/** The hash of the Wasm blob, which must already be installed on-chain. */
|
|
172
|
+
wasmHash: Buffer | string;
|
|
173
|
+
/** Salt used to generate the contract's ID. Passed through to {@link Operation.createCustomContract}. Default: random. */
|
|
174
|
+
salt?: Buffer | Uint8Array;
|
|
175
|
+
/** The format used to decode `wasmHash`, if it's provided as a string. */
|
|
176
|
+
format?: "hex" | "base64";
|
|
177
|
+
}): Promise<AssembledTransaction<T>>;
|
|
170
178
|
constructor(options: ContractClientOptions);
|
|
171
179
|
readonly fromJSON: {
|
|
172
180
|
add_signer: (json: string) => AssembledTransaction<null>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.3.
|
|
2
|
+
"version": "0.3.2",
|
|
3
3
|
"name": "sac-sdk",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src/index.ts",
|
|
@@ -13,6 +13,6 @@
|
|
|
13
13
|
"@stellar/stellar-sdk": "13.0.0"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"typescript": "5.
|
|
16
|
+
"typescript": "5.7.2"
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -3,21 +3,12 @@ import {
|
|
|
3
3
|
AssembledTransaction,
|
|
4
4
|
Client as ContractClient,
|
|
5
5
|
ClientOptions as ContractClientOptions,
|
|
6
|
-
|
|
6
|
+
MethodOptions,
|
|
7
7
|
Spec as ContractSpec,
|
|
8
8
|
} from '@stellar/stellar-sdk/minimal/contract';
|
|
9
9
|
import type {
|
|
10
10
|
u32,
|
|
11
|
-
i32,
|
|
12
|
-
u64,
|
|
13
|
-
i64,
|
|
14
|
-
u128,
|
|
15
11
|
i128,
|
|
16
|
-
u256,
|
|
17
|
-
i256,
|
|
18
|
-
Option,
|
|
19
|
-
Typepoint,
|
|
20
|
-
Duration,
|
|
21
12
|
} from '@stellar/stellar-sdk/minimal/contract';
|
|
22
13
|
|
|
23
14
|
if (typeof window !== 'undefined') {
|
|
@@ -43,7 +34,7 @@ export interface Client {
|
|
|
43
34
|
*
|
|
44
35
|
* The amount returned is the amount that spender is allowed to transfer
|
|
45
36
|
* out of from's balance. When the spender transfers amounts, the allowance
|
|
46
|
-
* will be reduced by the amount
|
|
37
|
+
* will be reduced by the amount transferred.
|
|
47
38
|
*
|
|
48
39
|
* # Arguments
|
|
49
40
|
*
|
|
@@ -100,7 +91,7 @@ export interface Client {
|
|
|
100
91
|
* The amount set is the amount that spender is approved to transfer out of
|
|
101
92
|
* from's balance. The spender will be allowed to transfer amounts, and
|
|
102
93
|
* when an amount is transferred the allowance will be reduced by the
|
|
103
|
-
* amount
|
|
94
|
+
* amount transferred.
|
|
104
95
|
*
|
|
105
96
|
* # Arguments
|
|
106
97
|
*
|
|
@@ -176,8 +167,8 @@ export interface Client {
|
|
|
176
167
|
*
|
|
177
168
|
* # Events
|
|
178
169
|
*
|
|
179
|
-
* Emits an event with topics `["burn", from: Address], data =
|
|
180
|
-
* i128
|
|
170
|
+
* Emits an event with topics `["burn", from: Address], data = amount:
|
|
171
|
+
* i128`
|
|
181
172
|
*/
|
|
182
173
|
burn: ({ from, amount }: { from: string, amount: i128 }, options?: {
|
|
183
174
|
/**
|
|
@@ -218,8 +209,8 @@ export interface Client {
|
|
|
218
209
|
*
|
|
219
210
|
* # Events
|
|
220
211
|
*
|
|
221
|
-
* Emits an event with topics `["burn", from: Address], data =
|
|
222
|
-
* i128
|
|
212
|
+
* Emits an event with topics `["burn", from: Address], data = amount:
|
|
213
|
+
* i128`
|
|
223
214
|
*/
|
|
224
215
|
burn_from: ({ spender, from, amount }: { spender: string, from: string, amount: i128 }, options?: {
|
|
225
216
|
/**
|
|
@@ -252,7 +243,7 @@ export interface Client {
|
|
|
252
243
|
* # Events
|
|
253
244
|
*
|
|
254
245
|
* Emits an event with topics `["clawback", admin: Address, to: Address],
|
|
255
|
-
* data =
|
|
246
|
+
* data = amount: i128`
|
|
256
247
|
*/
|
|
257
248
|
clawback: ({ from, amount }: { from: string, amount: i128 }, options?: {
|
|
258
249
|
/**
|
|
@@ -308,7 +299,7 @@ export interface Client {
|
|
|
308
299
|
* # Events
|
|
309
300
|
*
|
|
310
301
|
* Emits an event with topics `["mint", admin: Address, to: Address], data
|
|
311
|
-
* =
|
|
302
|
+
* = amount: i128`
|
|
312
303
|
*/
|
|
313
304
|
mint: ({ to, amount }: { to: string, amount: i128 }, options?: {
|
|
314
305
|
/**
|
|
@@ -479,7 +470,7 @@ export interface Client {
|
|
|
479
470
|
* # Events
|
|
480
471
|
*
|
|
481
472
|
* Emits an event with topics `["transfer", from: Address, to: Address],
|
|
482
|
-
* data =
|
|
473
|
+
* data = amount: i128`
|
|
483
474
|
*/
|
|
484
475
|
transfer: ({ from, to, amount }: { from: string, to: string, amount: i128 }, options?: {
|
|
485
476
|
/**
|
|
@@ -521,7 +512,7 @@ export interface Client {
|
|
|
521
512
|
* # Events
|
|
522
513
|
*
|
|
523
514
|
* Emits an event with topics `["transfer", from: Address, to: Address],
|
|
524
|
-
* data =
|
|
515
|
+
* data = amount: i128`
|
|
525
516
|
*/
|
|
526
517
|
transfer_from: ({ spender, from, to, amount }: { spender: string, from: string, to: string, amount: i128 }, options?: {
|
|
527
518
|
/**
|
|
@@ -542,24 +533,38 @@ export interface Client {
|
|
|
542
533
|
|
|
543
534
|
}
|
|
544
535
|
export class Client extends ContractClient {
|
|
536
|
+
static async deploy<T = Client>(
|
|
537
|
+
/** Options for initalizing a Client as well as for calling a method, with extras specific to deploying. */
|
|
538
|
+
options: MethodOptions &
|
|
539
|
+
Omit<ContractClientOptions, "contractId"> & {
|
|
540
|
+
/** The hash of the Wasm blob, which must already be installed on-chain. */
|
|
541
|
+
wasmHash: Buffer | string;
|
|
542
|
+
/** Salt used to generate the contract's ID. Passed through to {@link Operation.createCustomContract}. Default: random. */
|
|
543
|
+
salt?: Buffer | Uint8Array;
|
|
544
|
+
/** The format used to decode `wasmHash`, if it's provided as a string. */
|
|
545
|
+
format?: "hex" | "base64";
|
|
546
|
+
}
|
|
547
|
+
): Promise<AssembledTransaction<T>> {
|
|
548
|
+
return ContractClient.deploy(null, options)
|
|
549
|
+
}
|
|
545
550
|
constructor(public readonly options: ContractClientOptions) {
|
|
546
551
|
super(
|
|
547
|
-
new ContractSpec(["
|
|
552
|
+
new ContractSpec(["AAAAAAAAAYpSZXR1cm5zIHRoZSBhbGxvd2FuY2UgZm9yIGBzcGVuZGVyYCB0byB0cmFuc2ZlciBmcm9tIGBmcm9tYC4KClRoZSBhbW91bnQgcmV0dXJuZWQgaXMgdGhlIGFtb3VudCB0aGF0IHNwZW5kZXIgaXMgYWxsb3dlZCB0byB0cmFuc2ZlcgpvdXQgb2YgZnJvbSdzIGJhbGFuY2UuIFdoZW4gdGhlIHNwZW5kZXIgdHJhbnNmZXJzIGFtb3VudHMsIHRoZSBhbGxvd2FuY2UKd2lsbCBiZSByZWR1Y2VkIGJ5IHRoZSBhbW91bnQgdHJhbnNmZXJyZWQuCgojIEFyZ3VtZW50cwoKKiBgZnJvbWAgLSBUaGUgYWRkcmVzcyBob2xkaW5nIHRoZSBiYWxhbmNlIG9mIHRva2VucyB0byBiZSBkcmF3biBmcm9tLgoqIGBzcGVuZGVyYCAtIFRoZSBhZGRyZXNzIHNwZW5kaW5nIHRoZSB0b2tlbnMgaGVsZCBieSBgZnJvbWAuAAAAAAAJYWxsb3dhbmNlAAAAAAAAAgAAAAAAAAAEZnJvbQAAABMAAAAAAAAAB3NwZW5kZXIAAAAAEw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NwZW5kZXIKaGFzIG9uIHRoZSBmcm9tJ3MgYmFsYW5jZS4gVGhlIHNwZW5kZXIncyBhbGxvd2FuY2Ugb24gZnJvbSdzIGJhbGFuY2UKd2lsbCBiZSByZWR1Y2VkIGJ5IHRoZSBhbW91bnQuCgojIEFyZ3VtZW50cwoKKiBgc3BlbmRlcmAgLSBUaGUgYWRkcmVzcyBhdXRob3JpemluZyB0aGUgdHJhbnNmZXIsIGFuZCBoYXZpbmcgaXRzCmFsbG93YW5jZSBjb25zdW1lZCBkdXJpbmcgdGhlIHRyYW5zZmVyLgoqIGBmcm9tYCAtIFRoZSBhZGRyZXNzIGhvbGRpbmcgdGhlIGJhbGFuY2Ugb2YgdG9rZW5zIHdoaWNoIHdpbGwgYmUKd2l0aGRyYXduIGZyb20uCiogYHRvYCAtIFRoZSBhZGRyZXNzIHdoaWNoIHdpbGwgcmVjZWl2ZSB0aGUgdHJhbnNmZXJyZWQgdG9rZW5zLgoqIGBhbW91bnRgIC0gVGhlIGFtb3VudCBvZiB0b2tlbnMgdG8gYmUgdHJhbnNmZXJyZWQuCgojIEV2ZW50cwoKRW1pdHMgYW4gZXZlbnQgd2l0aCB0b3BpY3MgYFsidHJhbnNmZXIiLCBmcm9tOiBBZGRyZXNzLCB0bzogQWRkcmVzc10sCmRhdGEgPSBhbW91bnQ6IGkxMjhgAAAAAAAADXRyYW5zZmVyX2Zyb20AAAAAAAAEAAAAAAAAAAdzcGVuZGVyAAAAABMAAAAAAAAABGZyb20AAAATAAAAAAAAAAJ0bwAAAAAAEwAAAAAAAAAGYW1vdW50AAAAAAALAAAAAA=="]),
|
|
563
568
|
options
|
|
564
569
|
)
|
|
565
570
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Buffer } from "buffer";
|
|
2
|
+
import { AssembledTransaction, Client as ContractClient, ClientOptions as ContractClientOptions, MethodOptions } from '@stellar/stellar-sdk/minimal/contract';
|
|
2
3
|
import type { u32, i128 } from '@stellar/stellar-sdk/minimal/contract';
|
|
3
4
|
export declare const networks: {
|
|
4
5
|
readonly testnet: {
|
|
@@ -14,7 +15,7 @@ export interface Client {
|
|
|
14
15
|
*
|
|
15
16
|
* The amount returned is the amount that spender is allowed to transfer
|
|
16
17
|
* out of from's balance. When the spender transfers amounts, the allowance
|
|
17
|
-
* will be reduced by the amount
|
|
18
|
+
* will be reduced by the amount transferred.
|
|
18
19
|
*
|
|
19
20
|
* # Arguments
|
|
20
21
|
*
|
|
@@ -70,7 +71,7 @@ export interface Client {
|
|
|
70
71
|
* The amount set is the amount that spender is approved to transfer out of
|
|
71
72
|
* from's balance. The spender will be allowed to transfer amounts, and
|
|
72
73
|
* when an amount is transferred the allowance will be reduced by the
|
|
73
|
-
* amount
|
|
74
|
+
* amount transferred.
|
|
74
75
|
*
|
|
75
76
|
* # Arguments
|
|
76
77
|
*
|
|
@@ -147,8 +148,8 @@ export interface Client {
|
|
|
147
148
|
*
|
|
148
149
|
* # Events
|
|
149
150
|
*
|
|
150
|
-
* Emits an event with topics `["burn", from: Address], data =
|
|
151
|
-
* i128
|
|
151
|
+
* Emits an event with topics `["burn", from: Address], data = amount:
|
|
152
|
+
* i128`
|
|
152
153
|
*/
|
|
153
154
|
burn: ({ from, amount }: {
|
|
154
155
|
from: string;
|
|
@@ -189,8 +190,8 @@ export interface Client {
|
|
|
189
190
|
*
|
|
190
191
|
* # Events
|
|
191
192
|
*
|
|
192
|
-
* Emits an event with topics `["burn", from: Address], data =
|
|
193
|
-
* i128
|
|
193
|
+
* Emits an event with topics `["burn", from: Address], data = amount:
|
|
194
|
+
* i128`
|
|
194
195
|
*/
|
|
195
196
|
burn_from: ({ spender, from, amount }: {
|
|
196
197
|
spender: string;
|
|
@@ -224,7 +225,7 @@ export interface Client {
|
|
|
224
225
|
* # Events
|
|
225
226
|
*
|
|
226
227
|
* Emits an event with topics `["clawback", admin: Address, to: Address],
|
|
227
|
-
* data =
|
|
228
|
+
* data = amount: i128`
|
|
228
229
|
*/
|
|
229
230
|
clawback: ({ from, amount }: {
|
|
230
231
|
from: string;
|
|
@@ -277,7 +278,7 @@ export interface Client {
|
|
|
277
278
|
* # Events
|
|
278
279
|
*
|
|
279
280
|
* Emits an event with topics `["mint", admin: Address, to: Address], data
|
|
280
|
-
* =
|
|
281
|
+
* = amount: i128`
|
|
281
282
|
*/
|
|
282
283
|
mint: ({ to, amount }: {
|
|
283
284
|
to: string;
|
|
@@ -438,7 +439,7 @@ export interface Client {
|
|
|
438
439
|
* # Events
|
|
439
440
|
*
|
|
440
441
|
* Emits an event with topics `["transfer", from: Address, to: Address],
|
|
441
|
-
* data =
|
|
442
|
+
* data = amount: i128`
|
|
442
443
|
*/
|
|
443
444
|
transfer: ({ from, to, amount }: {
|
|
444
445
|
from: string;
|
|
@@ -481,7 +482,7 @@ export interface Client {
|
|
|
481
482
|
* # Events
|
|
482
483
|
*
|
|
483
484
|
* Emits an event with topics `["transfer", from: Address, to: Address],
|
|
484
|
-
* data =
|
|
485
|
+
* data = amount: i128`
|
|
485
486
|
*/
|
|
486
487
|
transfer_from: ({ spender, from, to, amount }: {
|
|
487
488
|
spender: string;
|
|
@@ -505,6 +506,16 @@ export interface Client {
|
|
|
505
506
|
}
|
|
506
507
|
export declare class Client extends ContractClient {
|
|
507
508
|
readonly options: ContractClientOptions;
|
|
509
|
+
static deploy<T = Client>(
|
|
510
|
+
/** Options for initalizing a Client as well as for calling a method, with extras specific to deploying. */
|
|
511
|
+
options: MethodOptions & Omit<ContractClientOptions, "contractId"> & {
|
|
512
|
+
/** The hash of the Wasm blob, which must already be installed on-chain. */
|
|
513
|
+
wasmHash: Buffer | string;
|
|
514
|
+
/** Salt used to generate the contract's ID. Passed through to {@link Operation.createCustomContract}. Default: random. */
|
|
515
|
+
salt?: Buffer | Uint8Array;
|
|
516
|
+
/** The format used to decode `wasmHash`, if it's provided as a string. */
|
|
517
|
+
format?: "hex" | "base64";
|
|
518
|
+
}): Promise<AssembledTransaction<T>>;
|
|
508
519
|
constructor(options: ContractClientOptions);
|
|
509
520
|
readonly fromJSON: {
|
|
510
521
|
allowance: (json: string) => AssembledTransaction<bigint>;
|
package/src/index.ts
CHANGED
|
@@ -2,5 +2,4 @@ export { SignerStore, SignerKey, type Signer, type SignerLimits } from './types'
|
|
|
2
2
|
export { PasskeyKit } from "./kit"
|
|
3
3
|
export { PasskeyServer } from "./server"
|
|
4
4
|
export { SACClient } from "./sac"
|
|
5
|
-
export { Client as PasskeyClient } from 'passkey-kit-sdk'
|
|
6
|
-
export { Client as FactoryClient } from 'passkey-factory-sdk'
|
|
5
|
+
export { Client as PasskeyClient } from 'passkey-kit-sdk'
|
package/src/kit.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Client as FactoryClient } from 'passkey-factory-sdk'
|
|
2
1
|
import { Client as PasskeyClient, type Signature, type SignerKey as SDKSignerKey, type SignerLimits as SDKSignerLimits } from 'passkey-kit-sdk'
|
|
3
2
|
import { StrKey, hash, xdr, Keypair, Address } from '@stellar/stellar-sdk/minimal'
|
|
4
3
|
import type { AuthenticatorAttestationResponseJSON, AuthenticatorSelectionCriteria } from "@simplewebauthn/types"
|
|
@@ -7,69 +6,69 @@ import { Buffer } from 'buffer'
|
|
|
7
6
|
import base64url from 'base64url'
|
|
8
7
|
import type { SignerKey, SignerLimits, SignerStore } from './types'
|
|
9
8
|
import { PasskeyBase } from './base'
|
|
10
|
-
import { AssembledTransaction, DEFAULT_TIMEOUT, type Tx } from '@stellar/stellar-sdk/minimal/contract'
|
|
9
|
+
import { AssembledTransaction, basicNodeSigner, DEFAULT_TIMEOUT, type Tx } from '@stellar/stellar-sdk/minimal/contract'
|
|
11
10
|
import type { Server } from '@stellar/stellar-sdk/minimal/rpc'
|
|
12
11
|
|
|
13
|
-
// TODO Return base64url encoded strings as well as buffers
|
|
14
|
-
|
|
15
12
|
export class PasskeyKit extends PasskeyBase {
|
|
16
|
-
declare
|
|
17
|
-
declare
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
declare rpc: Server
|
|
14
|
+
declare rpcUrl: string
|
|
15
|
+
|
|
16
|
+
private keyId: string | undefined
|
|
17
|
+
private networkPassphrase: string
|
|
18
|
+
private walletKeypair = Keypair.fromRawEd25519Seed(Buffer.alloc(32))
|
|
19
|
+
private walletPublicKey = this.walletKeypair.publicKey()
|
|
20
|
+
private walletWasmHash: string
|
|
21
|
+
private WebAuthn: {
|
|
23
22
|
startRegistration: typeof startRegistration,
|
|
24
23
|
startAuthentication: typeof startAuthentication
|
|
25
24
|
}
|
|
25
|
+
|
|
26
|
+
public wallet: PasskeyClient | undefined
|
|
26
27
|
|
|
27
28
|
constructor(options: {
|
|
28
29
|
rpcUrl: string,
|
|
29
30
|
networkPassphrase: string,
|
|
30
|
-
|
|
31
|
+
walletWasmHash: string,
|
|
31
32
|
WebAuthn?: {
|
|
32
33
|
startRegistration: typeof startRegistration,
|
|
33
34
|
startAuthentication: typeof startAuthentication
|
|
34
35
|
}
|
|
35
36
|
}) {
|
|
36
|
-
const { rpcUrl, networkPassphrase,
|
|
37
|
+
const { rpcUrl, networkPassphrase, walletWasmHash, WebAuthn } = options
|
|
37
38
|
|
|
38
39
|
super(rpcUrl)
|
|
39
40
|
|
|
40
41
|
this.networkPassphrase = networkPassphrase
|
|
41
|
-
this.
|
|
42
|
-
contractId: factoryContractId,
|
|
43
|
-
networkPassphrase,
|
|
44
|
-
rpcUrl
|
|
45
|
-
})
|
|
42
|
+
this.walletWasmHash = walletWasmHash
|
|
46
43
|
this.WebAuthn = WebAuthn || { startRegistration, startAuthentication }
|
|
47
44
|
}
|
|
48
45
|
|
|
49
46
|
public async createWallet(app: string, user: string) {
|
|
50
47
|
const { keyId, keyId_base64, publicKey } = await this.createKey(app, user)
|
|
51
48
|
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
49
|
+
const at = await PasskeyClient.deploy(
|
|
50
|
+
{
|
|
51
|
+
signer: {
|
|
52
|
+
tag: 'Secp256r1',
|
|
53
|
+
values: [
|
|
54
|
+
keyId,
|
|
55
|
+
publicKey,
|
|
56
|
+
undefined,
|
|
57
|
+
[new Map()],
|
|
58
|
+
{ tag: 'Persistent', values: undefined },
|
|
59
|
+
]
|
|
60
|
+
}
|
|
63
61
|
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
62
|
+
{
|
|
63
|
+
rpcUrl: this.rpcUrl,
|
|
64
|
+
wasmHash: this.walletWasmHash,
|
|
65
|
+
networkPassphrase: this.networkPassphrase,
|
|
66
|
+
publicKey: this.walletPublicKey,
|
|
67
|
+
salt: hash(keyId),
|
|
68
|
+
}
|
|
69
|
+
)
|
|
71
70
|
|
|
72
|
-
const contractId = result.
|
|
71
|
+
const contractId = at.result.options.contractId
|
|
73
72
|
|
|
74
73
|
this.wallet = new PasskeyClient({
|
|
75
74
|
contractId,
|
|
@@ -77,11 +76,15 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
77
76
|
rpcUrl: this.rpcUrl
|
|
78
77
|
})
|
|
79
78
|
|
|
79
|
+
await at.sign({
|
|
80
|
+
signTransaction: basicNodeSigner(this.walletKeypair, this.networkPassphrase).signTransaction
|
|
81
|
+
})
|
|
82
|
+
|
|
80
83
|
return {
|
|
81
84
|
keyId,
|
|
82
85
|
keyId_base64,
|
|
83
86
|
contractId,
|
|
84
|
-
built
|
|
87
|
+
built: at.signed
|
|
85
88
|
}
|
|
86
89
|
}
|
|
87
90
|
|
|
@@ -93,9 +96,9 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
93
96
|
const displayName = `${user} — ${now.toLocaleString()}`
|
|
94
97
|
const { rpId, authenticatorSelection = {
|
|
95
98
|
residentKey: "preferred",
|
|
96
|
-
userVerification: "
|
|
99
|
+
userVerification: "preferred",
|
|
97
100
|
} } = settings || {}
|
|
98
|
-
const { id, response
|
|
101
|
+
const { id, response } = await this.WebAuthn.startRegistration({
|
|
99
102
|
optionsJSON: {
|
|
100
103
|
challenge: base64url("stellaristhebetterblockchain"),
|
|
101
104
|
rp: {
|
|
@@ -135,7 +138,7 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
135
138
|
optionsJSON: {
|
|
136
139
|
challenge: base64url("stellaristhebetterblockchain"),
|
|
137
140
|
rpId,
|
|
138
|
-
userVerification: "
|
|
141
|
+
userVerification: "preferred",
|
|
139
142
|
}
|
|
140
143
|
});
|
|
141
144
|
|
|
@@ -158,7 +161,7 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
158
161
|
networkId: hash(Buffer.from(this.networkPassphrase)),
|
|
159
162
|
contractIdPreimage: xdr.ContractIdPreimage.contractIdPreimageFromAddress(
|
|
160
163
|
new xdr.ContractIdPreimageFromAddress({
|
|
161
|
-
address: Address.fromString(this.
|
|
164
|
+
address: Address.fromString(this.walletPublicKey).toScAddress(),
|
|
162
165
|
salt: hash(keyIdBuffer),
|
|
163
166
|
})
|
|
164
167
|
)
|
|
@@ -277,7 +280,7 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
277
280
|
? {
|
|
278
281
|
challenge: base64url(payload),
|
|
279
282
|
rpId,
|
|
280
|
-
userVerification: "
|
|
283
|
+
userVerification: "preferred",
|
|
281
284
|
}
|
|
282
285
|
: {
|
|
283
286
|
challenge: base64url(payload),
|
|
@@ -290,7 +293,7 @@ export class PasskeyKit extends PasskeyBase {
|
|
|
290
293
|
type: "public-key",
|
|
291
294
|
},
|
|
292
295
|
],
|
|
293
|
-
userVerification: "
|
|
296
|
+
userVerification: "preferred",
|
|
294
297
|
}
|
|
295
298
|
});
|
|
296
299
|
|
package/src/sac.ts
CHANGED
|
@@ -3,9 +3,10 @@ import { PasskeyBase } from "./base"
|
|
|
3
3
|
import type { Server } from '@stellar/stellar-sdk/minimal/rpc'
|
|
4
4
|
|
|
5
5
|
export class SACClient extends PasskeyBase {
|
|
6
|
-
declare
|
|
7
|
-
declare
|
|
8
|
-
|
|
6
|
+
declare rpc: Server
|
|
7
|
+
declare rpcUrl: string
|
|
8
|
+
|
|
9
|
+
private networkPassphrase: string
|
|
9
10
|
|
|
10
11
|
constructor(options: {
|
|
11
12
|
networkPassphrase: string,
|
package/src/server.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { xdr } from "@stellar/stellar-sdk/minimal"
|
|
1
|
+
import { Transaction, xdr, Networks, Operation } from "@stellar/stellar-sdk/minimal"
|
|
2
2
|
import { PasskeyBase } from "./base"
|
|
3
3
|
import base64url from "base64url"
|
|
4
4
|
import type { Tx } from "@stellar/stellar-sdk/minimal/contract"
|
|
@@ -7,12 +7,12 @@ import { AssembledTransaction } from "@stellar/stellar-sdk/minimal/contract"
|
|
|
7
7
|
import { Durability } from "@stellar/stellar-sdk/minimal/rpc"
|
|
8
8
|
|
|
9
9
|
export class PasskeyServer extends PasskeyBase {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
private launchtubeUrl: string | undefined
|
|
11
|
+
private launchtubeJwt: string | undefined
|
|
12
|
+
private mercuryProjectName: string | undefined
|
|
13
|
+
private mercuryUrl: string | undefined
|
|
14
|
+
private mercuryJwt: string | undefined
|
|
15
|
+
private mercuryKey: string | undefined
|
|
16
16
|
|
|
17
17
|
constructor(options: {
|
|
18
18
|
rpcUrl?: string,
|
package/types/index.d.ts
CHANGED
package/types/kit.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Client as FactoryClient } from 'passkey-factory-sdk';
|
|
2
1
|
import { Client as PasskeyClient } from 'passkey-kit-sdk';
|
|
3
2
|
import { xdr, Keypair } from '@stellar/stellar-sdk/minimal';
|
|
4
3
|
import type { AuthenticatorSelectionCriteria } from "@simplewebauthn/types";
|
|
@@ -11,18 +10,17 @@ import type { Server } from '@stellar/stellar-sdk/minimal/rpc';
|
|
|
11
10
|
export declare class PasskeyKit extends PasskeyBase {
|
|
12
11
|
rpc: Server;
|
|
13
12
|
rpcUrl: string;
|
|
14
|
-
keyId
|
|
15
|
-
networkPassphrase
|
|
16
|
-
|
|
13
|
+
private keyId;
|
|
14
|
+
private networkPassphrase;
|
|
15
|
+
private walletKeypair;
|
|
16
|
+
private walletPublicKey;
|
|
17
|
+
private walletWasmHash;
|
|
18
|
+
private WebAuthn;
|
|
17
19
|
wallet: PasskeyClient | undefined;
|
|
18
|
-
WebAuthn: {
|
|
19
|
-
startRegistration: typeof startRegistration;
|
|
20
|
-
startAuthentication: typeof startAuthentication;
|
|
21
|
-
};
|
|
22
20
|
constructor(options: {
|
|
23
21
|
rpcUrl: string;
|
|
24
22
|
networkPassphrase: string;
|
|
25
|
-
|
|
23
|
+
walletWasmHash: string;
|
|
26
24
|
WebAuthn?: {
|
|
27
25
|
startRegistration: typeof startRegistration;
|
|
28
26
|
startAuthentication: typeof startAuthentication;
|
|
@@ -32,7 +30,7 @@ export declare class PasskeyKit extends PasskeyBase {
|
|
|
32
30
|
keyId: Buffer<ArrayBufferLike>;
|
|
33
31
|
keyId_base64: string;
|
|
34
32
|
contractId: string;
|
|
35
|
-
built: Tx;
|
|
33
|
+
built: Tx | undefined;
|
|
36
34
|
}>;
|
|
37
35
|
createKey(app: string, user: string, settings?: {
|
|
38
36
|
rpId?: string;
|
package/types/sac.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { Server } from '@stellar/stellar-sdk/minimal/rpc';
|
|
|
4
4
|
export declare class SACClient extends PasskeyBase {
|
|
5
5
|
rpc: Server;
|
|
6
6
|
rpcUrl: string;
|
|
7
|
-
networkPassphrase
|
|
7
|
+
private networkPassphrase;
|
|
8
8
|
constructor(options: {
|
|
9
9
|
networkPassphrase: string;
|
|
10
10
|
rpcUrl: string;
|
package/types/server.d.ts
CHANGED
|
@@ -3,12 +3,12 @@ import type { Tx } from "@stellar/stellar-sdk/minimal/contract";
|
|
|
3
3
|
import type { Signer } from "./types";
|
|
4
4
|
import { AssembledTransaction } from "@stellar/stellar-sdk/minimal/contract";
|
|
5
5
|
export declare class PasskeyServer extends PasskeyBase {
|
|
6
|
-
launchtubeUrl
|
|
7
|
-
launchtubeJwt
|
|
8
|
-
mercuryProjectName
|
|
9
|
-
mercuryUrl
|
|
10
|
-
mercuryJwt
|
|
11
|
-
mercuryKey
|
|
6
|
+
private launchtubeUrl;
|
|
7
|
+
private launchtubeJwt;
|
|
8
|
+
private mercuryProjectName;
|
|
9
|
+
private mercuryUrl;
|
|
10
|
+
private mercuryJwt;
|
|
11
|
+
private mercuryKey;
|
|
12
12
|
constructor(options: {
|
|
13
13
|
rpcUrl?: string;
|
|
14
14
|
launchtubeUrl?: string;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
# passkey-factory-sdk JS
|
|
2
|
-
|
|
3
|
-
JS library for interacting with [Soroban](https://soroban.stellar.org/) smart contract `passkey-factory-sdk` via Soroban RPC.
|
|
4
|
-
|
|
5
|
-
This library was automatically generated by Soroban CLI using a command similar to:
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
soroban contract bindings ts \
|
|
9
|
-
--rpc-url https://soroban-testnet.stellar.org \
|
|
10
|
-
--network-passphrase "Test SDF Network ; September 2015" \
|
|
11
|
-
--contract-id CDSGG7BSWYWQMTY5KTZVDTC34ZESMZ75ZGSTTVHS4NIKCF4PM3GDJ4G3 \
|
|
12
|
-
--output-dir ./path/to/passkey-factory-sdk
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
The network passphrase and contract ID are exported from [index.ts](./src/index.ts) in the `networks` constant. If you are the one who generated this library and you know that this contract is also deployed to other networks, feel free to update `networks` with other valid options. This will help your contract consumers use this library more easily.
|
|
16
|
-
|
|
17
|
-
# To publish or not to publish
|
|
18
|
-
|
|
19
|
-
This library is suitable for publishing to NPM. You can publish it to NPM using the `npm publish` command.
|
|
20
|
-
|
|
21
|
-
But you don't need to publish this library to NPM to use it. You can add it to your project's `package.json` using a file path:
|
|
22
|
-
|
|
23
|
-
```json
|
|
24
|
-
"dependencies": {
|
|
25
|
-
"passkey-factory-sdk": "./path/to/this/folder"
|
|
26
|
-
}
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
However, we've actually encountered [frustration](https://github.com/stellar/soroban-example-dapp/pull/117#discussion_r1232873560) using local libraries with NPM in this way. Though it seems a bit messy, we suggest generating the library directly to your `node_modules` folder automatically after each install by using a `postinstall` script. We've had the least trouble with this approach. NPM will automatically remove what it sees as erroneous directories during the `install` step, and then regenerate them when it gets to your `postinstall` step, which will keep the library up-to-date with your contract.
|
|
30
|
-
|
|
31
|
-
```json
|
|
32
|
-
"scripts": {
|
|
33
|
-
"postinstall": "soroban contract bindings ts --rpc-url https://soroban-testnet.stellar.org --network-passphrase \"Test SDF Network ; September 2015\" --id CDSGG7BSWYWQMTY5KTZVDTC34ZESMZ75ZGSTTVHS4NIKCF4PM3GDJ4G3 --name passkey-factory-sdk"
|
|
34
|
-
}
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Obviously you need to adjust the above command based on the actual command you used to generate the library.
|
|
38
|
-
|
|
39
|
-
# Use it
|
|
40
|
-
|
|
41
|
-
Now that you have your library up-to-date and added to your project, you can import it in a file and see inline documentation for all of its exported methods:
|
|
42
|
-
|
|
43
|
-
```js
|
|
44
|
-
import { Contract, networks } from "passkey-factory-sdk"
|
|
45
|
-
|
|
46
|
-
const contract = new Contract({
|
|
47
|
-
...networks.futurenet, // for example; check which networks this library exports
|
|
48
|
-
rpcUrl: '...', // use your own, or find one for testing at https://soroban.stellar.org/docs/reference/rpc#public-rpc-providers
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
contract.|
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
As long as your editor is configured to show JavaScript/TypeScript documentation, you can pause your typing at that `|` to get a list of all exports and inline-documentation for each. It exports a separate [async](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function) function for each method in the smart contract, with documentation for each generated from the comments the contract's author included in the original source code.
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": "0.6.1",
|
|
3
|
-
"name": "passkey-factory-sdk",
|
|
4
|
-
"type": "module",
|
|
5
|
-
"main": "src/index.ts",
|
|
6
|
-
"types": "types/index.d.ts",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"prepublishOnly": "pnpm run build",
|
|
9
|
-
"build": "tsc"
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"buffer": "6.0.3",
|
|
13
|
-
"@stellar/stellar-sdk": "13.0.0"
|
|
14
|
-
},
|
|
15
|
-
"devDependencies": {
|
|
16
|
-
"typescript": "5.6.2"
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { Buffer } from "buffer";
|
|
2
|
-
import {
|
|
3
|
-
AssembledTransaction,
|
|
4
|
-
Client as ContractClient,
|
|
5
|
-
ClientOptions as ContractClientOptions,
|
|
6
|
-
Result,
|
|
7
|
-
Spec as ContractSpec,
|
|
8
|
-
} from '@stellar/stellar-sdk/minimal/contract';
|
|
9
|
-
import type {
|
|
10
|
-
u32,
|
|
11
|
-
i32,
|
|
12
|
-
u64,
|
|
13
|
-
i64,
|
|
14
|
-
u128,
|
|
15
|
-
i128,
|
|
16
|
-
u256,
|
|
17
|
-
i256,
|
|
18
|
-
Option,
|
|
19
|
-
Typepoint,
|
|
20
|
-
Duration,
|
|
21
|
-
} from '@stellar/stellar-sdk/minimal/contract';
|
|
22
|
-
|
|
23
|
-
if (typeof window !== 'undefined') {
|
|
24
|
-
//@ts-ignore Buffer exists
|
|
25
|
-
window.Buffer = window.Buffer || Buffer;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export const networks = {
|
|
29
|
-
testnet: {
|
|
30
|
-
networkPassphrase: "Test SDF Network ; September 2015",
|
|
31
|
-
contractId: "NIL",
|
|
32
|
-
}
|
|
33
|
-
} as const
|
|
34
|
-
|
|
35
|
-
export type SignerKey = { tag: "Policy", values: readonly [string] } | { tag: "Ed25519", values: readonly [Buffer] } | { tag: "Secp256r1", values: readonly [Buffer] };
|
|
36
|
-
|
|
37
|
-
export type SignerLimits = readonly [Map<string, Option<Array<SignerKey>>>];
|
|
38
|
-
export type SignerStorage = { tag: "Persistent", values: void } | { tag: "Temporary", values: void };
|
|
39
|
-
|
|
40
|
-
export type Signer = { tag: "Policy", values: readonly [string, Option<u32>, SignerLimits, SignerStorage] } | { tag: "Ed25519", values: readonly [Buffer, Option<u32>, SignerLimits, SignerStorage] } | { tag: "Secp256r1", values: readonly [Buffer, Buffer, Option<u32>, SignerLimits, SignerStorage] };
|
|
41
|
-
|
|
42
|
-
export const Errors = {
|
|
43
|
-
1: { message: "NotInitialized" },
|
|
44
|
-
|
|
45
|
-
2: { message: "AlreadyInitialized" }
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface Client {
|
|
49
|
-
/**
|
|
50
|
-
* Construct and simulate a init transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
51
|
-
*/
|
|
52
|
-
init: ({ wasm_hash }: { wasm_hash: Buffer }, options?: {
|
|
53
|
-
/**
|
|
54
|
-
* The fee to pay for the transaction. Default: BASE_FEE
|
|
55
|
-
*/
|
|
56
|
-
fee?: number;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
60
|
-
*/
|
|
61
|
-
timeoutInSeconds?: number;
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
65
|
-
*/
|
|
66
|
-
simulate?: boolean;
|
|
67
|
-
}) => Promise<AssembledTransaction<Result<void>>>
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Construct and simulate a deploy transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
71
|
-
*/
|
|
72
|
-
deploy: ({ salt, signer }: { salt: Buffer, signer: Signer }, options?: {
|
|
73
|
-
/**
|
|
74
|
-
* The fee to pay for the transaction. Default: BASE_FEE
|
|
75
|
-
*/
|
|
76
|
-
fee?: number;
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
80
|
-
*/
|
|
81
|
-
timeoutInSeconds?: number;
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
85
|
-
*/
|
|
86
|
-
simulate?: boolean;
|
|
87
|
-
}) => Promise<AssembledTransaction<Result<string>>>
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
export class Client extends ContractClient {
|
|
91
|
-
constructor(public readonly options: ContractClientOptions) {
|
|
92
|
-
super(
|
|
93
|
-
new ContractSpec(["AAAAAgAAAAAAAAAAAAAACVNpZ25lcktleQAAAAAAAAMAAAABAAAAAAAAAAZQb2xpY3kAAAAAAAEAAAATAAAAAQAAAAAAAAAHRWQyNTUxOQAAAAABAAAD7gAAACAAAAABAAAAAAAAAAlTZWNwMjU2cjEAAAAAAAABAAAADg==",
|
|
94
|
-
"AAAAAQAAAAAAAAAAAAAADFNpZ25lckxpbWl0cwAAAAEAAAAAAAAAATAAAAAAAAPsAAAAEwAAA+gAAAPqAAAH0AAAAAlTaWduZXJLZXkAAAA=",
|
|
95
|
-
"AAAAAgAAAAAAAAAAAAAADVNpZ25lclN0b3JhZ2UAAAAAAAACAAAAAAAAAAAAAAAKUGVyc2lzdGVudAAAAAAAAAAAAAAAAAAJVGVtcG9yYXJ5AAAA",
|
|
96
|
-
"AAAAAgAAAAAAAAAAAAAABlNpZ25lcgAAAAAAAwAAAAEAAAAAAAAABlBvbGljeQAAAAAABAAAABMAAAPoAAAABAAAB9AAAAAMU2lnbmVyTGltaXRzAAAH0AAAAA1TaWduZXJTdG9yYWdlAAAAAAAAAQAAAAAAAAAHRWQyNTUxOQAAAAAEAAAD7gAAACAAAAPoAAAABAAAB9AAAAAMU2lnbmVyTGltaXRzAAAH0AAAAA1TaWduZXJTdG9yYWdlAAAAAAAAAQAAAAAAAAAJU2VjcDI1NnIxAAAAAAAABQAAAA4AAAPuAAAAQQAAA+gAAAAEAAAH0AAAAAxTaWduZXJMaW1pdHMAAAfQAAAADVNpZ25lclN0b3JhZ2UAAAA=",
|
|
97
|
-
"AAAABAAAAAAAAAAAAAAABUVycm9yAAAAAAAAAgAAAAAAAAAOTm90SW5pdGlhbGl6ZWQAAAAAAAEAAAAAAAAAEkFscmVhZHlJbml0aWFsaXplZAAAAAAAAg==",
|
|
98
|
-
"AAAAAAAAAAAAAAAEaW5pdAAAAAEAAAAAAAAACXdhc21faGFzaAAAAAAAA+4AAAAgAAAAAQAAA+kAAAPtAAAAAAAAAAM=",
|
|
99
|
-
"AAAAAAAAAAAAAAAGZGVwbG95AAAAAAACAAAAAAAAAARzYWx0AAAD7gAAACAAAAAAAAAABnNpZ25lcgAAAAAH0AAAAAZTaWduZXIAAAAAAAEAAAPpAAAAEwAAAAM="]),
|
|
100
|
-
options
|
|
101
|
-
)
|
|
102
|
-
}
|
|
103
|
-
public readonly fromJSON = {
|
|
104
|
-
init: this.txFromJSON<Result<void>>,
|
|
105
|
-
deploy: this.txFromJSON<Result<string>>
|
|
106
|
-
}
|
|
107
|
-
}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
4
|
-
/* Projects */
|
|
5
|
-
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
|
6
|
-
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
7
|
-
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
|
8
|
-
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
|
9
|
-
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
10
|
-
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
11
|
-
/* Language and Environment */
|
|
12
|
-
"target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
13
|
-
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
14
|
-
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
15
|
-
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
|
16
|
-
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
17
|
-
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
18
|
-
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
19
|
-
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
|
20
|
-
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
|
21
|
-
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
22
|
-
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
23
|
-
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
24
|
-
/* Modules */
|
|
25
|
-
"module": "NodeNext", /* Specify what module code is generated. */
|
|
26
|
-
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
27
|
-
"moduleResolution": "nodenext", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
28
|
-
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
29
|
-
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
30
|
-
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
31
|
-
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
32
|
-
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
33
|
-
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
34
|
-
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
35
|
-
// "resolveJsonModule": true, /* Enable importing .json files. */
|
|
36
|
-
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
37
|
-
/* JavaScript Support */
|
|
38
|
-
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
39
|
-
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
40
|
-
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
41
|
-
/* Emit */
|
|
42
|
-
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
43
|
-
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
44
|
-
"emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
45
|
-
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
46
|
-
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
47
|
-
"outDir": "./types", /* Specify an output folder for all emitted files. */
|
|
48
|
-
// "removeComments": true, /* Disable emitting comments. */
|
|
49
|
-
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
50
|
-
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
51
|
-
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
|
52
|
-
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
53
|
-
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
54
|
-
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
55
|
-
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
56
|
-
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
57
|
-
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
58
|
-
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
59
|
-
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
60
|
-
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
61
|
-
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
62
|
-
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
63
|
-
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
64
|
-
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
65
|
-
/* Interop Constraints */
|
|
66
|
-
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
67
|
-
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
68
|
-
// "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
|
69
|
-
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
70
|
-
// "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
71
|
-
/* Type Checking */
|
|
72
|
-
// "strict": true, /* Enable all strict type-checking options. */
|
|
73
|
-
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
74
|
-
"strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
75
|
-
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
76
|
-
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
77
|
-
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
78
|
-
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
79
|
-
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
80
|
-
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
81
|
-
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
82
|
-
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
83
|
-
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
84
|
-
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
85
|
-
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
86
|
-
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
87
|
-
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
88
|
-
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
89
|
-
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
90
|
-
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
91
|
-
/* Completeness */
|
|
92
|
-
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
93
|
-
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
94
|
-
},
|
|
95
|
-
"include": [
|
|
96
|
-
"src/*"
|
|
97
|
-
]
|
|
98
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { Buffer } from "buffer";
|
|
2
|
-
import { AssembledTransaction, Client as ContractClient, ClientOptions as ContractClientOptions, Result } from '@stellar/stellar-sdk/minimal/contract';
|
|
3
|
-
import type { u32, Option } from '@stellar/stellar-sdk/minimal/contract';
|
|
4
|
-
export declare const networks: {
|
|
5
|
-
readonly testnet: {
|
|
6
|
-
readonly networkPassphrase: "Test SDF Network ; September 2015";
|
|
7
|
-
readonly contractId: "NIL";
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
export type SignerKey = {
|
|
11
|
-
tag: "Policy";
|
|
12
|
-
values: readonly [string];
|
|
13
|
-
} | {
|
|
14
|
-
tag: "Ed25519";
|
|
15
|
-
values: readonly [Buffer];
|
|
16
|
-
} | {
|
|
17
|
-
tag: "Secp256r1";
|
|
18
|
-
values: readonly [Buffer];
|
|
19
|
-
};
|
|
20
|
-
export type SignerLimits = readonly [Map<string, Option<Array<SignerKey>>>];
|
|
21
|
-
export type SignerStorage = {
|
|
22
|
-
tag: "Persistent";
|
|
23
|
-
values: void;
|
|
24
|
-
} | {
|
|
25
|
-
tag: "Temporary";
|
|
26
|
-
values: void;
|
|
27
|
-
};
|
|
28
|
-
export type Signer = {
|
|
29
|
-
tag: "Policy";
|
|
30
|
-
values: readonly [string, Option<u32>, SignerLimits, SignerStorage];
|
|
31
|
-
} | {
|
|
32
|
-
tag: "Ed25519";
|
|
33
|
-
values: readonly [Buffer, Option<u32>, SignerLimits, SignerStorage];
|
|
34
|
-
} | {
|
|
35
|
-
tag: "Secp256r1";
|
|
36
|
-
values: readonly [Buffer, Buffer, Option<u32>, SignerLimits, SignerStorage];
|
|
37
|
-
};
|
|
38
|
-
export declare const Errors: {
|
|
39
|
-
1: {
|
|
40
|
-
message: string;
|
|
41
|
-
};
|
|
42
|
-
2: {
|
|
43
|
-
message: string;
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
export interface Client {
|
|
47
|
-
/**
|
|
48
|
-
* Construct and simulate a init transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
49
|
-
*/
|
|
50
|
-
init: ({ wasm_hash }: {
|
|
51
|
-
wasm_hash: Buffer;
|
|
52
|
-
}, options?: {
|
|
53
|
-
/**
|
|
54
|
-
* The fee to pay for the transaction. Default: BASE_FEE
|
|
55
|
-
*/
|
|
56
|
-
fee?: number;
|
|
57
|
-
/**
|
|
58
|
-
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
59
|
-
*/
|
|
60
|
-
timeoutInSeconds?: number;
|
|
61
|
-
/**
|
|
62
|
-
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
63
|
-
*/
|
|
64
|
-
simulate?: boolean;
|
|
65
|
-
}) => Promise<AssembledTransaction<Result<void>>>;
|
|
66
|
-
/**
|
|
67
|
-
* Construct and simulate a deploy transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
68
|
-
*/
|
|
69
|
-
deploy: ({ salt, signer }: {
|
|
70
|
-
salt: Buffer;
|
|
71
|
-
signer: Signer;
|
|
72
|
-
}, options?: {
|
|
73
|
-
/**
|
|
74
|
-
* The fee to pay for the transaction. Default: BASE_FEE
|
|
75
|
-
*/
|
|
76
|
-
fee?: number;
|
|
77
|
-
/**
|
|
78
|
-
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
79
|
-
*/
|
|
80
|
-
timeoutInSeconds?: number;
|
|
81
|
-
/**
|
|
82
|
-
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
83
|
-
*/
|
|
84
|
-
simulate?: boolean;
|
|
85
|
-
}) => Promise<AssembledTransaction<Result<string>>>;
|
|
86
|
-
}
|
|
87
|
-
export declare class Client extends ContractClient {
|
|
88
|
-
readonly options: ContractClientOptions;
|
|
89
|
-
constructor(options: ContractClientOptions);
|
|
90
|
-
readonly fromJSON: {
|
|
91
|
-
init: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/minimal/contract").ErrorMessage>>;
|
|
92
|
-
deploy: (json: string) => AssembledTransaction<Result<string, import("@stellar/stellar-sdk/minimal/contract").ErrorMessage>>;
|
|
93
|
-
};
|
|
94
|
-
}
|