passkey-kit 0.0.1 → 0.0.2
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/package.json +3 -2
- package/src/index.ts +2 -1
- package/src/passkey-factory-sdk/dist/index.d.ts +138 -0
- package/src/passkey-factory-sdk/dist/index.js +41 -0
- package/src/passkey-kit-sdk/dist/index.d.ts +158 -0
- package/src/passkey-kit-sdk/dist/index.js +48 -0
- package/.gitattributes +0 -2
- package/demo/.vscode/extensions.json +0 -3
- package/demo/README.md +0 -47
- package/demo/index.html +0 -13
- package/demo/package.json +0 -22
- package/demo/pnpm-lock.yaml +0 -1253
- package/demo/public/vite.svg +0 -1
- package/demo/src/App.svelte +0 -169
- package/demo/src/app.css +0 -14
- package/demo/src/lib/account.ts +0 -81
- package/demo/src/lib/common.ts +0 -10
- package/demo/src/lib/utils.ts +0 -6
- package/demo/src/main.ts +0 -15
- package/demo/src/vite-env.d.ts +0 -17
- package/demo/svelte.config.js +0 -7
- package/demo/tsconfig.json +0 -22
- package/demo/tsconfig.node.json +0 -10
- package/demo/vite.config.ts +0 -7
- package/esbuild.js +0 -20
- package/passkey-kit/index.d.ts +0 -46
- package/passkey-kit/index.js +0 -135
- package/passkey-kit/index.js.map +0 -7
- package/tsconfig.json +0 -30
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "passkey-kit",
|
|
3
3
|
"main": "src/index.ts",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build:demo": "cd demo && pnpm i && pnpm run build",
|
|
@@ -22,5 +22,6 @@
|
|
|
22
22
|
"esbuild": "^0.21.4",
|
|
23
23
|
"esbuild-plugin-polyfill-node": "^0.3.0",
|
|
24
24
|
"typescript": "^5.4.5"
|
|
25
|
-
}
|
|
25
|
+
},
|
|
26
|
+
"files": ["src/**/*"]
|
|
26
27
|
}
|
package/src/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { Buffer } from 'buffer'
|
|
|
11
11
|
/* TODO
|
|
12
12
|
- Clean up these params and the interface as a whole
|
|
13
13
|
Might put wallet activities and maybe factory as well into the root of the class vs buried inside this.wallet and this.factory
|
|
14
|
+
- Right now publicKey can mean a Stellar public key or a passkey public key, there should be a noted difference
|
|
14
15
|
*/
|
|
15
16
|
|
|
16
17
|
export class PasskeyAccount {
|
|
@@ -131,7 +132,7 @@ export class PasskeyAccount {
|
|
|
131
132
|
if (!this.id)
|
|
132
133
|
this.id = startAuthenticationResponse.id
|
|
133
134
|
|
|
134
|
-
const { keyId
|
|
135
|
+
const { keyId } = await this.getKey(startAuthenticationResponse)
|
|
135
136
|
|
|
136
137
|
// NOTE might not need this for derivation as all signers are stored in the factory and we can use that lookup as both primary and secondary
|
|
137
138
|
let contractId = StrKey.encodeContract(hash(xdr.HashIdPreimage.envelopeTypeContractId(
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import { Buffer } from "buffer";
|
|
3
|
+
import { AssembledTransaction, Client as ContractClient, ClientOptions as ContractClientOptions, Result } from '@stellar/stellar-sdk/contract';
|
|
4
|
+
export * from '@stellar/stellar-sdk';
|
|
5
|
+
export * as contract from '@stellar/stellar-sdk/contract';
|
|
6
|
+
export * as rpc from '@stellar/stellar-sdk/rpc';
|
|
7
|
+
export declare const networks: {
|
|
8
|
+
readonly testnet: {
|
|
9
|
+
readonly networkPassphrase: "Test SDF Network ; September 2015";
|
|
10
|
+
readonly contractId: "CDSGG7BSWYWQMTY5KTZVDTC34ZESMZ75ZGSTTVHS4NIKCF4PM3GDJ4G3";
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export declare const Errors: {
|
|
14
|
+
1: {
|
|
15
|
+
message: string;
|
|
16
|
+
};
|
|
17
|
+
2: {
|
|
18
|
+
message: string;
|
|
19
|
+
};
|
|
20
|
+
3: {
|
|
21
|
+
message: string;
|
|
22
|
+
};
|
|
23
|
+
4: {
|
|
24
|
+
message: string;
|
|
25
|
+
};
|
|
26
|
+
5: {
|
|
27
|
+
message: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export interface Client {
|
|
31
|
+
/**
|
|
32
|
+
* Construct and simulate a extend_ttl 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.
|
|
33
|
+
*/
|
|
34
|
+
extend_ttl: (options?: {
|
|
35
|
+
/**
|
|
36
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
37
|
+
*/
|
|
38
|
+
fee?: number;
|
|
39
|
+
/**
|
|
40
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
41
|
+
*/
|
|
42
|
+
timeoutInSeconds?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
45
|
+
*/
|
|
46
|
+
simulate?: boolean;
|
|
47
|
+
}) => Promise<AssembledTransaction<null>>;
|
|
48
|
+
/**
|
|
49
|
+
* 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.
|
|
50
|
+
*/
|
|
51
|
+
init: ({ wasm_hash }: {
|
|
52
|
+
wasm_hash: Buffer;
|
|
53
|
+
}, options?: {
|
|
54
|
+
/**
|
|
55
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
56
|
+
*/
|
|
57
|
+
fee?: number;
|
|
58
|
+
/**
|
|
59
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
60
|
+
*/
|
|
61
|
+
timeoutInSeconds?: number;
|
|
62
|
+
/**
|
|
63
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
64
|
+
*/
|
|
65
|
+
simulate?: boolean;
|
|
66
|
+
}) => Promise<AssembledTransaction<Result<void>>>;
|
|
67
|
+
/**
|
|
68
|
+
* 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.
|
|
69
|
+
*/
|
|
70
|
+
deploy: ({ id, pk }: {
|
|
71
|
+
id: Buffer;
|
|
72
|
+
pk: Buffer;
|
|
73
|
+
}, options?: {
|
|
74
|
+
/**
|
|
75
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
76
|
+
*/
|
|
77
|
+
fee?: number;
|
|
78
|
+
/**
|
|
79
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
80
|
+
*/
|
|
81
|
+
timeoutInSeconds?: number;
|
|
82
|
+
/**
|
|
83
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
84
|
+
*/
|
|
85
|
+
simulate?: boolean;
|
|
86
|
+
}) => Promise<AssembledTransaction<Result<string>>>;
|
|
87
|
+
/**
|
|
88
|
+
* Construct and simulate a add_sig 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.
|
|
89
|
+
*/
|
|
90
|
+
add_sig: ({ id, contract }: {
|
|
91
|
+
id: Buffer;
|
|
92
|
+
contract: string;
|
|
93
|
+
}, options?: {
|
|
94
|
+
/**
|
|
95
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
96
|
+
*/
|
|
97
|
+
fee?: number;
|
|
98
|
+
/**
|
|
99
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
100
|
+
*/
|
|
101
|
+
timeoutInSeconds?: number;
|
|
102
|
+
/**
|
|
103
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
104
|
+
*/
|
|
105
|
+
simulate?: boolean;
|
|
106
|
+
}) => Promise<AssembledTransaction<Result<void>>>;
|
|
107
|
+
/**
|
|
108
|
+
* Construct and simulate a rm_sig 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.
|
|
109
|
+
*/
|
|
110
|
+
rm_sig: ({ id, contract }: {
|
|
111
|
+
id: Buffer;
|
|
112
|
+
contract: string;
|
|
113
|
+
}, options?: {
|
|
114
|
+
/**
|
|
115
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
116
|
+
*/
|
|
117
|
+
fee?: number;
|
|
118
|
+
/**
|
|
119
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
120
|
+
*/
|
|
121
|
+
timeoutInSeconds?: number;
|
|
122
|
+
/**
|
|
123
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
124
|
+
*/
|
|
125
|
+
simulate?: boolean;
|
|
126
|
+
}) => Promise<AssembledTransaction<Result<void>>>;
|
|
127
|
+
}
|
|
128
|
+
export declare class Client extends ContractClient {
|
|
129
|
+
readonly options: ContractClientOptions;
|
|
130
|
+
constructor(options: ContractClientOptions);
|
|
131
|
+
readonly fromJSON: {
|
|
132
|
+
extend_ttl: (json: string) => AssembledTransaction<null>;
|
|
133
|
+
init: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
|
|
134
|
+
deploy: (json: string) => AssembledTransaction<Result<string, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
|
|
135
|
+
add_sig: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
|
|
136
|
+
rm_sig: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
|
|
137
|
+
};
|
|
138
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Buffer } from "buffer";
|
|
2
|
+
import { Client as ContractClient, Spec as ContractSpec, } from '@stellar/stellar-sdk/contract';
|
|
3
|
+
export * from '@stellar/stellar-sdk';
|
|
4
|
+
export * as contract from '@stellar/stellar-sdk/contract';
|
|
5
|
+
export * as rpc from '@stellar/stellar-sdk/rpc';
|
|
6
|
+
if (typeof window !== 'undefined') {
|
|
7
|
+
//@ts-ignore Buffer exists
|
|
8
|
+
window.Buffer = window.Buffer || Buffer;
|
|
9
|
+
}
|
|
10
|
+
export const networks = {
|
|
11
|
+
testnet: {
|
|
12
|
+
networkPassphrase: "Test SDF Network ; September 2015",
|
|
13
|
+
contractId: "CDSGG7BSWYWQMTY5KTZVDTC34ZESMZ75ZGSTTVHS4NIKCF4PM3GDJ4G3",
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
export const Errors = {
|
|
17
|
+
1: { message: "" },
|
|
18
|
+
2: { message: "" },
|
|
19
|
+
3: { message: "" },
|
|
20
|
+
4: { message: "" },
|
|
21
|
+
5: { message: "" }
|
|
22
|
+
};
|
|
23
|
+
export class Client extends ContractClient {
|
|
24
|
+
options;
|
|
25
|
+
constructor(options) {
|
|
26
|
+
super(new ContractSpec(["AAAABAAAAAAAAAAAAAAABUVycm9yAAAAAAAABQAAAAAAAAAJTm90SW5pdGVkAAAAAAAAAQAAAAAAAAAITm90Rm91bmQAAAACAAAAAAAAAAxOb3RQZXJtaXR0ZWQAAAADAAAAAAAAAA1BbHJlYWR5SW5pdGVkAAAAAAAABAAAAAAAAAANQWxyZWFkeU1hcHBlZAAAAAAAAAU=",
|
|
27
|
+
"AAAAAAAAAAAAAAAKZXh0ZW5kX3R0bAAAAAAAAAAAAAA=",
|
|
28
|
+
"AAAAAAAAAAAAAAAEaW5pdAAAAAEAAAAAAAAACXdhc21faGFzaAAAAAAAA+4AAAAgAAAAAQAAA+kAAAPtAAAAAAAAAAM=",
|
|
29
|
+
"AAAAAAAAAAAAAAAGZGVwbG95AAAAAAACAAAAAAAAAAJpZAAAAAAADgAAAAAAAAACcGsAAAAAA+4AAABBAAAAAQAAA+kAAAATAAAAAw==",
|
|
30
|
+
"AAAAAAAAAAAAAAAHYWRkX3NpZwAAAAACAAAAAAAAAAJpZAAAAAAADgAAAAAAAAAIY29udHJhY3QAAAATAAAAAQAAA+kAAAPtAAAAAAAAAAM=",
|
|
31
|
+
"AAAAAAAAAAAAAAAGcm1fc2lnAAAAAAACAAAAAAAAAAJpZAAAAAAADgAAAAAAAAAIY29udHJhY3QAAAATAAAAAQAAA+kAAAPtAAAAAAAAAAM="]), options);
|
|
32
|
+
this.options = options;
|
|
33
|
+
}
|
|
34
|
+
fromJSON = {
|
|
35
|
+
extend_ttl: (this.txFromJSON),
|
|
36
|
+
init: (this.txFromJSON),
|
|
37
|
+
deploy: (this.txFromJSON),
|
|
38
|
+
add_sig: (this.txFromJSON),
|
|
39
|
+
rm_sig: (this.txFromJSON)
|
|
40
|
+
};
|
|
41
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { Buffer } from "buffer";
|
|
2
|
+
import { AssembledTransaction, Client as ContractClient, ClientOptions as ContractClientOptions, Result } from '@stellar/stellar-sdk/contract';
|
|
3
|
+
export * from '@stellar/stellar-sdk';
|
|
4
|
+
export * as contract from '@stellar/stellar-sdk/contract';
|
|
5
|
+
export * as rpc from '@stellar/stellar-sdk/rpc';
|
|
6
|
+
export declare const networks: {
|
|
7
|
+
readonly testnet: {
|
|
8
|
+
readonly networkPassphrase: "Test SDF Network ; September 2015";
|
|
9
|
+
readonly contractId: "CDSGG7BSWYWQMTY5KTZVDTC34ZESMZ75ZGSTTVHS4NIKCF4PM3GDJ4G3";
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export declare const Errors: {
|
|
13
|
+
1: {
|
|
14
|
+
message: string;
|
|
15
|
+
};
|
|
16
|
+
2: {
|
|
17
|
+
message: string;
|
|
18
|
+
};
|
|
19
|
+
3: {
|
|
20
|
+
message: string;
|
|
21
|
+
};
|
|
22
|
+
4: {
|
|
23
|
+
message: string;
|
|
24
|
+
};
|
|
25
|
+
5: {
|
|
26
|
+
message: string;
|
|
27
|
+
};
|
|
28
|
+
6: {
|
|
29
|
+
message: string;
|
|
30
|
+
};
|
|
31
|
+
7: {
|
|
32
|
+
message: string;
|
|
33
|
+
};
|
|
34
|
+
8: {
|
|
35
|
+
message: string;
|
|
36
|
+
};
|
|
37
|
+
9: {
|
|
38
|
+
message: string;
|
|
39
|
+
};
|
|
40
|
+
10: {
|
|
41
|
+
message: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export interface Signature {
|
|
45
|
+
authenticator_data: Buffer;
|
|
46
|
+
client_data_json: Buffer;
|
|
47
|
+
id: Buffer;
|
|
48
|
+
signature: Buffer;
|
|
49
|
+
}
|
|
50
|
+
export interface Client {
|
|
51
|
+
/**
|
|
52
|
+
* Construct and simulate a extend_ttl 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.
|
|
53
|
+
*/
|
|
54
|
+
extend_ttl: (options?: {
|
|
55
|
+
/**
|
|
56
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
57
|
+
*/
|
|
58
|
+
fee?: number;
|
|
59
|
+
/**
|
|
60
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
61
|
+
*/
|
|
62
|
+
timeoutInSeconds?: number;
|
|
63
|
+
/**
|
|
64
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
65
|
+
*/
|
|
66
|
+
simulate?: boolean;
|
|
67
|
+
}) => Promise<AssembledTransaction<null>>;
|
|
68
|
+
/**
|
|
69
|
+
* 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.
|
|
70
|
+
*/
|
|
71
|
+
init: ({ id, pk, factory }: {
|
|
72
|
+
id: Buffer;
|
|
73
|
+
pk: Buffer;
|
|
74
|
+
factory: string;
|
|
75
|
+
}, options?: {
|
|
76
|
+
/**
|
|
77
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
78
|
+
*/
|
|
79
|
+
fee?: number;
|
|
80
|
+
/**
|
|
81
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
82
|
+
*/
|
|
83
|
+
timeoutInSeconds?: number;
|
|
84
|
+
/**
|
|
85
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
86
|
+
*/
|
|
87
|
+
simulate?: boolean;
|
|
88
|
+
}) => Promise<AssembledTransaction<Result<void>>>;
|
|
89
|
+
/**
|
|
90
|
+
* Construct and simulate a resudo 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.
|
|
91
|
+
*/
|
|
92
|
+
resudo: ({ id }: {
|
|
93
|
+
id: Buffer;
|
|
94
|
+
}, options?: {
|
|
95
|
+
/**
|
|
96
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
97
|
+
*/
|
|
98
|
+
fee?: number;
|
|
99
|
+
/**
|
|
100
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
101
|
+
*/
|
|
102
|
+
timeoutInSeconds?: number;
|
|
103
|
+
/**
|
|
104
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
105
|
+
*/
|
|
106
|
+
simulate?: boolean;
|
|
107
|
+
}) => Promise<AssembledTransaction<Result<void>>>;
|
|
108
|
+
/**
|
|
109
|
+
* Construct and simulate a rm_sig 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.
|
|
110
|
+
*/
|
|
111
|
+
rm_sig: ({ id }: {
|
|
112
|
+
id: Buffer;
|
|
113
|
+
}, options?: {
|
|
114
|
+
/**
|
|
115
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
116
|
+
*/
|
|
117
|
+
fee?: number;
|
|
118
|
+
/**
|
|
119
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
120
|
+
*/
|
|
121
|
+
timeoutInSeconds?: number;
|
|
122
|
+
/**
|
|
123
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
124
|
+
*/
|
|
125
|
+
simulate?: boolean;
|
|
126
|
+
}) => Promise<AssembledTransaction<Result<void>>>;
|
|
127
|
+
/**
|
|
128
|
+
* Construct and simulate a add_sig 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.
|
|
129
|
+
*/
|
|
130
|
+
add_sig: ({ id, pk }: {
|
|
131
|
+
id: Buffer;
|
|
132
|
+
pk: Buffer;
|
|
133
|
+
}, options?: {
|
|
134
|
+
/**
|
|
135
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
136
|
+
*/
|
|
137
|
+
fee?: number;
|
|
138
|
+
/**
|
|
139
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
140
|
+
*/
|
|
141
|
+
timeoutInSeconds?: number;
|
|
142
|
+
/**
|
|
143
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
144
|
+
*/
|
|
145
|
+
simulate?: boolean;
|
|
146
|
+
}) => Promise<AssembledTransaction<Result<void>>>;
|
|
147
|
+
}
|
|
148
|
+
export declare class Client extends ContractClient {
|
|
149
|
+
readonly options: ContractClientOptions;
|
|
150
|
+
constructor(options: ContractClientOptions);
|
|
151
|
+
readonly fromJSON: {
|
|
152
|
+
extend_ttl: (json: string) => AssembledTransaction<null>;
|
|
153
|
+
init: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
|
|
154
|
+
resudo: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
|
|
155
|
+
rm_sig: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
|
|
156
|
+
add_sig: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
|
|
157
|
+
};
|
|
158
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Buffer } from "buffer";
|
|
2
|
+
import { Client as ContractClient, Spec as ContractSpec, } from '@stellar/stellar-sdk/contract';
|
|
3
|
+
export * from '@stellar/stellar-sdk';
|
|
4
|
+
export * as contract from '@stellar/stellar-sdk/contract';
|
|
5
|
+
export * as rpc from '@stellar/stellar-sdk/rpc';
|
|
6
|
+
if (typeof window !== 'undefined') {
|
|
7
|
+
//@ts-ignore Buffer exists
|
|
8
|
+
window.Buffer = window.Buffer || Buffer;
|
|
9
|
+
}
|
|
10
|
+
export const networks = {
|
|
11
|
+
testnet: {
|
|
12
|
+
networkPassphrase: "Test SDF Network ; September 2015",
|
|
13
|
+
contractId: "CDSGG7BSWYWQMTY5KTZVDTC34ZESMZ75ZGSTTVHS4NIKCF4PM3GDJ4G3",
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
export const Errors = {
|
|
17
|
+
1: { message: "" },
|
|
18
|
+
2: { message: "" },
|
|
19
|
+
3: { message: "" },
|
|
20
|
+
4: { message: "" },
|
|
21
|
+
5: { message: "" },
|
|
22
|
+
6: { message: "" },
|
|
23
|
+
7: { message: "" },
|
|
24
|
+
8: { message: "" },
|
|
25
|
+
9: { message: "" },
|
|
26
|
+
10: { message: "" }
|
|
27
|
+
};
|
|
28
|
+
export class Client extends ContractClient {
|
|
29
|
+
options;
|
|
30
|
+
constructor(options) {
|
|
31
|
+
super(new ContractSpec(["AAAABAAAAAAAAAAAAAAABUVycm9yAAAAAAAACgAAAAAAAAAJTm90SW5pdGVkAAAAAAAAAQAAAAAAAAAITm90Rm91bmQAAAACAAAAAAAAAAxOb3RQZXJtaXR0ZWQAAAADAAAAAAAAAA1BbHJlYWR5SW5pdGVkAAAAAAAABAAAAAAAAAAOSnNvblBhcnNlRXJyb3IAAAAAAAUAAAAAAAAADkludmFsaWRDb250ZXh0AAAAAAAGAAAAAAAAACBDbGllbnREYXRhSnNvbkNoYWxsZW5nZUluY29ycmVjdAAAAAcAAAAAAAAAF1NlY3AyNTZyMVB1YmxpY0tleVBhcnNlAAAAAAgAAAAAAAAAF1NlY3AyNTZyMVNpZ25hdHVyZVBhcnNlAAAAAAkAAAAAAAAAFVNlY3AyNTZyMVZlcmlmeUZhaWxlZAAAAAAAAAo=",
|
|
32
|
+
"AAAAAAAAAAAAAAAKZXh0ZW5kX3R0bAAAAAAAAAAAAAA=",
|
|
33
|
+
"AAAAAAAAAAAAAAAEaW5pdAAAAAMAAAAAAAAAAmlkAAAAAAAOAAAAAAAAAAJwawAAAAAD7gAAAEEAAAAAAAAAB2ZhY3RvcnkAAAAAEwAAAAEAAAPpAAAD7QAAAAAAAAAD",
|
|
34
|
+
"AAAAAAAAAAAAAAAGcmVzdWRvAAAAAAABAAAAAAAAAAJpZAAAAAAADgAAAAEAAAPpAAAD7QAAAAAAAAAD",
|
|
35
|
+
"AAAAAAAAAAAAAAAGcm1fc2lnAAAAAAABAAAAAAAAAAJpZAAAAAAADgAAAAEAAAPpAAAD7QAAAAAAAAAD",
|
|
36
|
+
"AAAAAAAAAAAAAAAHYWRkX3NpZwAAAAACAAAAAAAAAAJpZAAAAAAADgAAAAAAAAACcGsAAAAAA+4AAABBAAAAAQAAA+kAAAPtAAAAAAAAAAM=",
|
|
37
|
+
"AAAAAQAAAAAAAAAAAAAACVNpZ25hdHVyZQAAAAAAAAQAAAAAAAAAEmF1dGhlbnRpY2F0b3JfZGF0YQAAAAAADgAAAAAAAAAQY2xpZW50X2RhdGFfanNvbgAAAA4AAAAAAAAAAmlkAAAAAAAOAAAAAAAAAAlzaWduYXR1cmUAAAAAAAPuAAAAQA==",
|
|
38
|
+
"AAAAAAAAAAAAAAAMX19jaGVja19hdXRoAAAAAwAAAAAAAAARc2lnbmF0dXJlX3BheWxvYWQAAAAAAAPuAAAAIAAAAAAAAAAJc2lnbmF0dXJlAAAAAAAH0AAAAAlTaWduYXR1cmUAAAAAAAAAAAAADWF1dGhfY29udGV4dHMAAAAAAAPqAAAH0AAAAAdDb250ZXh0AAAAAAEAAAPpAAAD7QAAAAAAAAAD"]), options);
|
|
39
|
+
this.options = options;
|
|
40
|
+
}
|
|
41
|
+
fromJSON = {
|
|
42
|
+
extend_ttl: (this.txFromJSON),
|
|
43
|
+
init: (this.txFromJSON),
|
|
44
|
+
resudo: (this.txFromJSON),
|
|
45
|
+
rm_sig: (this.txFromJSON),
|
|
46
|
+
add_sig: (this.txFromJSON),
|
|
47
|
+
};
|
|
48
|
+
}
|
package/.gitattributes
DELETED
package/demo/README.md
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# Svelte + TS + Vite
|
|
2
|
-
|
|
3
|
-
This template should help get you started developing with Svelte and TypeScript in Vite.
|
|
4
|
-
|
|
5
|
-
## Recommended IDE Setup
|
|
6
|
-
|
|
7
|
-
[VS Code](https://code.visualstudio.com/) + [Svelte](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode).
|
|
8
|
-
|
|
9
|
-
## Need an official Svelte framework?
|
|
10
|
-
|
|
11
|
-
Check out [SvelteKit](https://github.com/sveltejs/kit#readme), which is also powered by Vite. Deploy anywhere with its serverless-first approach and adapt to various platforms, with out of the box support for TypeScript, SCSS, and Less, and easily-added support for mdsvex, GraphQL, PostCSS, Tailwind CSS, and more.
|
|
12
|
-
|
|
13
|
-
## Technical considerations
|
|
14
|
-
|
|
15
|
-
**Why use this over SvelteKit?**
|
|
16
|
-
|
|
17
|
-
- It brings its own routing solution which might not be preferable for some users.
|
|
18
|
-
- It is first and foremost a framework that just happens to use Vite under the hood, not a Vite app.
|
|
19
|
-
|
|
20
|
-
This template contains as little as possible to get started with Vite + TypeScript + Svelte, while taking into account the developer experience with regards to HMR and intellisense. It demonstrates capabilities on par with the other `create-vite` templates and is a good starting point for beginners dipping their toes into a Vite + Svelte project.
|
|
21
|
-
|
|
22
|
-
Should you later need the extended capabilities and extensibility provided by SvelteKit, the template has been structured similarly to SvelteKit so that it is easy to migrate.
|
|
23
|
-
|
|
24
|
-
**Why `global.d.ts` instead of `compilerOptions.types` inside `jsconfig.json` or `tsconfig.json`?**
|
|
25
|
-
|
|
26
|
-
Setting `compilerOptions.types` shuts out all other types not explicitly listed in the configuration. Using triple-slash references keeps the default TypeScript setting of accepting type information from the entire workspace, while also adding `svelte` and `vite/client` type information.
|
|
27
|
-
|
|
28
|
-
**Why include `.vscode/extensions.json`?**
|
|
29
|
-
|
|
30
|
-
Other templates indirectly recommend extensions via the README, but this file allows VS Code to prompt the user to install the recommended extension upon opening the project.
|
|
31
|
-
|
|
32
|
-
**Why enable `allowJs` in the TS template?**
|
|
33
|
-
|
|
34
|
-
While `allowJs: false` would indeed prevent the use of `.js` files in the project, it does not prevent the use of JavaScript syntax in `.svelte` files. In addition, it would force `checkJs: false`, bringing the worst of both worlds: not being able to guarantee the entire codebase is TypeScript, and also having worse typechecking for the existing JavaScript. In addition, there are valid use cases in which a mixed codebase may be relevant.
|
|
35
|
-
|
|
36
|
-
**Why is HMR not preserving my local component state?**
|
|
37
|
-
|
|
38
|
-
HMR state preservation comes with a number of gotchas! It has been disabled by default in both `svelte-hmr` and `@sveltejs/vite-plugin-svelte` due to its often surprising behavior. You can read the details [here](https://github.com/rixo/svelte-hmr#svelte-hmr).
|
|
39
|
-
|
|
40
|
-
If you have state that's important to retain within a component, consider creating an external store which would not be replaced by HMR.
|
|
41
|
-
|
|
42
|
-
```ts
|
|
43
|
-
// store.ts
|
|
44
|
-
// An extremely simple external store
|
|
45
|
-
import { writable } from 'svelte/store'
|
|
46
|
-
export default writable(0)
|
|
47
|
-
```
|
package/demo/index.html
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<title>Vite + Svelte + TS</title>
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
<div id="app"></div>
|
|
11
|
-
<script type="module" src="/src/main.ts"></script>
|
|
12
|
-
</body>
|
|
13
|
-
</html>
|
package/demo/package.json
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "demo",
|
|
3
|
-
"private": true,
|
|
4
|
-
"type": "module",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"dev": "vite",
|
|
7
|
-
"build": "vite build",
|
|
8
|
-
"preview": "vite preview",
|
|
9
|
-
"check": "svelte-check --tsconfig ./tsconfig.json"
|
|
10
|
-
},
|
|
11
|
-
"devDependencies": {
|
|
12
|
-
"@sveltejs/vite-plugin-svelte": "^3.1.1",
|
|
13
|
-
"@tsconfig/svelte": "^5.0.4",
|
|
14
|
-
"svelte": "^4.2.17",
|
|
15
|
-
"svelte-check": "^3.8.0",
|
|
16
|
-
"tslib": "^2.6.2",
|
|
17
|
-
"typescript": "^5.4.5",
|
|
18
|
-
"vite": "^5.2.12",
|
|
19
|
-
"buffer": "^6.0.3",
|
|
20
|
-
"passkey-kit": "link:../passkey-kit"
|
|
21
|
-
}
|
|
22
|
-
}
|