@tempoxyz/id 0.0.0-pr-494.sha-e349a84 → 0.0.0-pr-490.sha-3effdd1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/viem.d.ts +20 -11
- package/dist/plugins/viem.d.ts.map +1 -1
- package/dist/plugins/viem.js +41 -10
- package/dist/plugins/viem.js.map +1 -1
- package/dist/wagmi/index.d.ts.map +1 -1
- package/dist/wagmi/index.js +11 -5
- package/dist/wagmi/index.js.map +1 -1
- package/package.json +1 -10
- package/src/plugins/index.ts +1 -1
- package/src/plugins/viem.ts +72 -29
- package/src/wagmi/index.ts +17 -8
- package/dist/mpp/index.d.ts +0 -109
- package/dist/mpp/index.d.ts.map +0 -1
- package/dist/mpp/index.js +0 -159
- package/dist/mpp/index.js.map +0 -1
- package/src/mpp/index.ts +0 -249
package/dist/plugins/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* import { Id } from '@tempoxyz/id'
|
|
8
8
|
* import { email, passkey, viem } from '@tempoxyz/id/plugins'
|
|
9
9
|
*
|
|
10
|
-
* const tempoId = Id.create({ plugins: [email(), passkey(), viem({
|
|
10
|
+
* const tempoId = Id.create({ plugins: [email(), passkey(), viem({ chain: tempo })] })
|
|
11
11
|
* ```
|
|
12
12
|
* @module
|
|
13
13
|
*/
|
package/dist/plugins/index.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* import { Id } from '@tempoxyz/id'
|
|
8
8
|
* import { email, passkey, viem } from '@tempoxyz/id/plugins'
|
|
9
9
|
*
|
|
10
|
-
* const tempoId = Id.create({ plugins: [email(), passkey(), viem({
|
|
10
|
+
* const tempoId = Id.create({ plugins: [email(), passkey(), viem({ chain: tempo })] })
|
|
11
11
|
* ```
|
|
12
12
|
* @module
|
|
13
13
|
*/
|
package/dist/plugins/viem.d.ts
CHANGED
|
@@ -13,6 +13,9 @@ import type * as Session from '../Session.js';
|
|
|
13
13
|
* instance's chain, its transport, and an account that follows the instance's session.
|
|
14
14
|
* `tempoId.viem({ … })` returns a client with overrides, such as another chain, or a fixed `session`
|
|
15
15
|
* for one request on a backend. Without options, the clients use Tempo's chains and their own RPC.
|
|
16
|
+
* The plugin takes options, or a function that returns the options of a chain by its ID, such as
|
|
17
|
+
* for a transport of each chain. A chain ID is valid when it names a Tempo chain, or when its
|
|
18
|
+
* options name a `chain` of that ID.
|
|
16
19
|
*
|
|
17
20
|
* The access key signs transactions. On a page, the account's owner signs messages and typed data:
|
|
18
21
|
* the cloud wallet through Tempo ID, or the account's passkey. Elsewhere, and for a fixed session,
|
|
@@ -30,16 +33,17 @@ import type * as Session from '../Session.js';
|
|
|
30
33
|
* await tempoId.viem({ session }).token.transferSync({ amount, to, token })
|
|
31
34
|
* ```
|
|
32
35
|
*/
|
|
33
|
-
export declare function viem(options?: viem.Options): Plugin.Plugin<"viem", viem.Namespace, viem.Actions> & {
|
|
34
|
-
[pluginOptions]: viem.Options;
|
|
36
|
+
export declare function viem(options?: viem.Options | viem.Resolver): Plugin.Plugin<"viem", viem.Namespace, viem.Actions> & {
|
|
37
|
+
[pluginOptions]: viem.Resolver | viem.Options;
|
|
35
38
|
};
|
|
36
39
|
export declare namespace viem {
|
|
37
40
|
type Options = Omit<NonNullable<Parameters<typeof createClient>[0]>, 'account' | 'chain' | 'testnet' | 'transport'> & {
|
|
38
41
|
/**
|
|
39
|
-
* The
|
|
40
|
-
* Tempo mainnet, testnet, devnet,
|
|
42
|
+
* The chain of the options' chain ID, such as one with a `feeToken` or another RPC URL. A chain of
|
|
43
|
+
* another ID does not apply. Defaults to Tempo's chain of the ID: mainnet, testnet, devnet, or a
|
|
44
|
+
* local node.
|
|
41
45
|
*/
|
|
42
|
-
|
|
46
|
+
chain?: Chain | undefined;
|
|
43
47
|
/**
|
|
44
48
|
* Whether the account's owner signs messages and typed data, through the user's Tempo ID
|
|
45
49
|
* session: the cloud wallet through Tempo ID, or the account's passkey. Defaults to `true` on a
|
|
@@ -48,14 +52,19 @@ export declare namespace viem {
|
|
|
48
52
|
*/
|
|
49
53
|
owner?: boolean | undefined;
|
|
50
54
|
/**
|
|
51
|
-
* The transport of
|
|
52
|
-
* the chain's own RPC.
|
|
55
|
+
* The transport of the chain's clients. In the object form, it applies to the options' `chain`,
|
|
56
|
+
* or to the instance's chain without one. Defaults to `http()`, the chain's own RPC.
|
|
53
57
|
*/
|
|
54
|
-
|
|
58
|
+
transport?: Transport | undefined;
|
|
55
59
|
};
|
|
60
|
+
/** Returns the options of the chain of `chainId`. */
|
|
61
|
+
type Resolver = (chainId: number) => Options;
|
|
56
62
|
/** The overrides of a client, for one call. */
|
|
57
63
|
type Overrides = Omit<NonNullable<Parameters<typeof createClient>[0]>, 'account' | 'chain' | 'testnet'> & {
|
|
58
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* The chain ID: a Tempo chain, or one whose options name its `chain`. Defaults to the instance's
|
|
66
|
+
* `chainId`.
|
|
67
|
+
*/
|
|
59
68
|
chainId?: number | undefined;
|
|
60
69
|
/**
|
|
61
70
|
* A fixed session, such as one that `tempoId.backend.get` returns, whose access key signs. A
|
|
@@ -74,9 +83,9 @@ export declare namespace viem {
|
|
|
74
83
|
type Internal = 'account' | 'batch' | 'cacheTime' | 'ccipRead' | 'chain' | 'dataSuffix' | 'extend' | 'key' | 'name' | 'pollingInterval' | 'request' | 'scope' | 'tokens' | 'transport' | 'type' | 'uid';
|
|
75
84
|
/** The chains and transports of the plugin, which `tempoId.viem[settings]` returns. */
|
|
76
85
|
type Settings = {
|
|
77
|
-
/**
|
|
86
|
+
/** Tempo's chains, with the instance's chain first when it is another, each from its options. */
|
|
78
87
|
chains: readonly [Chain, ...Chain[]];
|
|
79
|
-
/** Returns the transport of the chain of `chainId`, or `http()` when
|
|
88
|
+
/** Returns the transport of the chain of `chainId`, or `http()` when its options hold none. */
|
|
80
89
|
transport: (chainId: number) => Transport;
|
|
81
90
|
};
|
|
82
91
|
/** `tempoId.viem`: the default client, which a call configures. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viem.d.ts","sourceRoot":"","sources":["../../src/plugins/viem.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,KAAK,KAAK,EAGV,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,MAAM,CAAA;AACb,OAAO,EAAE,KAAK,MAAM,IAAI,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAYrE,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,KAAK,KAAK,OAAO,MAAM,eAAe,CAAA;AAE7C
|
|
1
|
+
{"version":3,"file":"viem.d.ts","sourceRoot":"","sources":["../../src/plugins/viem.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,KAAK,KAAK,EAGV,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,MAAM,CAAA;AACb,OAAO,EAAE,KAAK,MAAM,IAAI,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAYrE,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,KAAK,KAAK,OAAO,MAAM,eAAe,CAAA;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,IAAI,CAAC,OAAO,GAAE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,QAAa;;EAqM9D;AAED,MAAM,CAAC,OAAO,WAAW,IAAI,CAAC;IAC5B,KAAK,OAAO,GAAG,IAAI,CACjB,WAAW,CAAC,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,EAC/C,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,WAAW,CAC9C,GAAG;QACF;;;;WAIG;QACH,KAAK,CAAC,EAAE,KAAK,GAAG,SAAS,CAAA;QACzB;;;;;WAKG;QACH,KAAK,CAAC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MAAM,QAAQ,eAA0B,CAAA;AAE/C;;;GAGG;AACH,eAAO,MAAM,aAAa,eAAyB,CAAA;AAQnD,kFAAkF;AAClF,iBAAS,KAAK,CACZ,UAAU,EAAE,IAAI,CACd,WAAW,CAAC,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,EAC/C,SAAS,GAAG,OAAO,GAAG,WAAW,CAClC,GAAG;IAAE,OAAO,EAAE,YAAY,CAAC;IAAC,KAAK,EAAE,KAAK,CAAC;IAAC,SAAS,EAAE,SAAS,CAAA;CAAE,GAChE,WAAW,CAAC,SAAS,EAAE,KAAK,EAAE,YAAY,CAAC,CAE7C"}
|
package/dist/plugins/viem.js
CHANGED
|
@@ -17,6 +17,9 @@ import * as Plugin from '../Plugin.js';
|
|
|
17
17
|
* instance's chain, its transport, and an account that follows the instance's session.
|
|
18
18
|
* `tempoId.viem({ … })` returns a client with overrides, such as another chain, or a fixed `session`
|
|
19
19
|
* for one request on a backend. Without options, the clients use Tempo's chains and their own RPC.
|
|
20
|
+
* The plugin takes options, or a function that returns the options of a chain by its ID, such as
|
|
21
|
+
* for a transport of each chain. A chain ID is valid when it names a Tempo chain, or when its
|
|
22
|
+
* options name a `chain` of that ID.
|
|
20
23
|
*
|
|
21
24
|
* The access key signs transactions. On a page, the account's owner signs messages and typed data:
|
|
22
25
|
* the cloud wallet through Tempo ID, or the account's passkey. Elsewhere, and for a fixed session,
|
|
@@ -35,12 +38,25 @@ import * as Plugin from '../Plugin.js';
|
|
|
35
38
|
* ```
|
|
36
39
|
*/
|
|
37
40
|
export function viem(options = {}) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
owner = typeof document !== 'undefined', transports = {}, ...defaults } = options;
|
|
41
|
+
/** Returns the options of the chain of `chainId`. */
|
|
42
|
+
const resolve = (chainId) => typeof options === 'function' ? options(chainId) : options;
|
|
41
43
|
const plugin = Plugin.from({
|
|
42
44
|
actions: (context) => {
|
|
43
45
|
const { config } = context;
|
|
46
|
+
/** Returns the chain of `chainId`: its options' `chain`, or Tempo's chain of that ID. */
|
|
47
|
+
function chainOf(chainId) {
|
|
48
|
+
const { chain } = resolve(chainId);
|
|
49
|
+
if (chain?.id === chainId)
|
|
50
|
+
return chain;
|
|
51
|
+
return defaultChains.find((entry) => entry.id === chainId);
|
|
52
|
+
}
|
|
53
|
+
// The wagmi plugin's config holds Tempo's chains, and the instance's chain when it is another.
|
|
54
|
+
const tempoChains = defaultChains.map((entry) => chainOf(entry.id));
|
|
55
|
+
const instanceChain = chainOf(config.chainId);
|
|
56
|
+
const chains = (instanceChain &&
|
|
57
|
+
!tempoChains.some((entry) => entry.id === instanceChain.id)
|
|
58
|
+
? [instanceChain, ...tempoChains]
|
|
59
|
+
: tempoChains);
|
|
44
60
|
// The account of each session on each chain, so a client rebuilds no access key at each read.
|
|
45
61
|
const accounts = new WeakMap();
|
|
46
62
|
// The clients without overrides beyond `chainId`, one for each chain.
|
|
@@ -48,10 +64,22 @@ export function viem(options = {}) {
|
|
|
48
64
|
// The plugin's chains and transports, which the clients and the wagmi plugin share.
|
|
49
65
|
const own = {
|
|
50
66
|
chains,
|
|
51
|
-
transport: (chainId) =>
|
|
52
|
-
|
|
53
|
-
|
|
67
|
+
transport: (chainId) => {
|
|
68
|
+
if (typeof options === 'function')
|
|
69
|
+
return options(chainId).transport ?? http();
|
|
70
|
+
// The object form names one chain: its `chain`, or the instance's chain. Other chains keep
|
|
71
|
+
// their own RPC, so one transport never serves another chain's requests.
|
|
72
|
+
const target = options.chain?.id ?? config.chainId;
|
|
73
|
+
return (chainId === target ? options.transport : undefined) ?? http();
|
|
74
|
+
},
|
|
54
75
|
};
|
|
76
|
+
/**
|
|
77
|
+
* Returns whether the account's owner signs on `chainId`. A page holds the user's Tempo ID
|
|
78
|
+
* session, through which the account's owner signs.
|
|
79
|
+
*/
|
|
80
|
+
function owner(chainId) {
|
|
81
|
+
return resolve(chainId).owner ?? typeof document !== 'undefined';
|
|
82
|
+
}
|
|
55
83
|
/**
|
|
56
84
|
* Returns a live access token of `session`, refreshed through the instance when it expires
|
|
57
85
|
* within the margin. Returns `undefined` when the instance holds another user's session.
|
|
@@ -76,16 +104,16 @@ export function viem(options = {}) {
|
|
|
76
104
|
byChain.set(chainId, Signer.fromSession(config, session, {
|
|
77
105
|
accessToken: () => accessToken(session),
|
|
78
106
|
chainId,
|
|
79
|
-
owner,
|
|
107
|
+
owner: owner(chainId),
|
|
80
108
|
}));
|
|
81
109
|
return byChain.get(chainId);
|
|
82
110
|
}
|
|
83
111
|
/** Returns a new client with `overrides`. */
|
|
84
112
|
function create(overrides = {}) {
|
|
85
113
|
const { chainId = config.chainId, session, transport, ...clientOptions } = overrides;
|
|
86
|
-
const chain =
|
|
114
|
+
const chain = chainOf(chainId);
|
|
87
115
|
if (!chain)
|
|
88
|
-
throw new Error(`Invalid chain: ${chainId} is not
|
|
116
|
+
throw new Error(`Invalid chain: ${chainId} is not a Tempo chain, and its options name no \`chain\`. Return its definition as \`chain\`.`);
|
|
89
117
|
const account = (() => {
|
|
90
118
|
if (!session)
|
|
91
119
|
return Signer.live(() => current(chainId));
|
|
@@ -98,6 +126,7 @@ export function viem(options = {}) {
|
|
|
98
126
|
throw new KeyRequiredError();
|
|
99
127
|
return fixed;
|
|
100
128
|
})();
|
|
129
|
+
const { chain: _chain, owner: _owner, transport: _transport, ...defaults } = resolve(chainId);
|
|
101
130
|
const client = build({
|
|
102
131
|
...defaults,
|
|
103
132
|
...clientOptions,
|
|
@@ -159,7 +188,7 @@ export function viem(options = {}) {
|
|
|
159
188
|
// sends no request, so its transport needs no URL, and a chain without one still builds.
|
|
160
189
|
const sample = build({
|
|
161
190
|
account: Signer.live(() => undefined),
|
|
162
|
-
chain: chains[0],
|
|
191
|
+
chain: namespace[settings].chains[0],
|
|
163
192
|
transport: custom({ request: () => Promise.resolve(undefined) }),
|
|
164
193
|
});
|
|
165
194
|
const members = {};
|
|
@@ -188,6 +217,8 @@ export const settings = Symbol('viem.settings');
|
|
|
188
217
|
* do not export it, so only the package's own plugins read it.
|
|
189
218
|
*/
|
|
190
219
|
export const pluginOptions = Symbol('viem.options');
|
|
220
|
+
/** Tempo's chains, which a chain ID without a `chain` in its options uses. */
|
|
221
|
+
const defaultChains = [tempo, tempoTestnet, tempoDevnet, tempoLocalnet];
|
|
191
222
|
/** The time before a token's expiry at which the owner's account read refreshes it, in milliseconds. */
|
|
192
223
|
const refreshMargin = 30_000;
|
|
193
224
|
/** Creates a Tempo client with an account and a chain, so its type holds both. */
|
package/dist/plugins/viem.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viem.js","sourceRoot":"","sources":["../../src/plugins/viem.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAEL,MAAM,EACN,IAAI,GAGL,MAAM,MAAM,CAAA;AACb,OAAO,EAA8B,YAAY,EAAE,MAAM,YAAY,CAAA;AACrE,OAAO,EACL,KAAK,EACL,WAAW,EACX,aAAa,EACb,YAAY,GACb,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,KAAK,IAAI,MAAM,qBAAqB,CAAA;AAC3C,OAAO,KAAK,SAAS,MAAM,+BAA+B,CAAA;AAC1D,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAA;AAC/C,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AAGtC
|
|
1
|
+
{"version":3,"file":"viem.js","sourceRoot":"","sources":["../../src/plugins/viem.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAEL,MAAM,EACN,IAAI,GAGL,MAAM,MAAM,CAAA;AACb,OAAO,EAA8B,YAAY,EAAE,MAAM,YAAY,CAAA;AACrE,OAAO,EACL,KAAK,EACL,WAAW,EACX,aAAa,EACb,YAAY,GACb,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,K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ChB,qDAAqD;QACrD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAA;KACrB,GAAG,IAAI,CAAC,OAAO,CAAA;IAEhB,oEAAoE;IACpE,KAAK,SAAS,GAAG,MAAM,GAAG,CAAC,CAAC,SAAS,CAAC,EAAE,SAAS,KAAK,MAAM,CAAC,CAAA;IAE7D,KAAK,OAAO,GAAG,IAAI,CACjB,sBAAsB,CACpB,SAAS,CAAC,KAAK,EAAE,GAAG,KAAK,EAAE,CAAC,EAC5B,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAC1B,EACD,QAAQ,GAAG,QAAQ,GAAG,YAAY,GAAG,YAAY,CAClD,GAAG;QACF,uFAAuF;QACvF,UAAU,CAAC,EAAE,SAAS,iBAAiB,EAAE,GAAG,SAAS,CAAA;KACtD,CAAA;IAED;;;OAGG;IACH,KAAK,SAAS,GAAG,OAAO,CAAA;CACzB"}
|
package/dist/wagmi/index.js
CHANGED
|
@@ -111,10 +111,16 @@ export function tempoId(options = {}) {
|
|
|
111
111
|
chainId: config.chains[0].id,
|
|
112
112
|
plugins: [
|
|
113
113
|
others,
|
|
114
|
-
viem({
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
viem((chainId) => {
|
|
115
|
+
const options = own?.[pluginOptions];
|
|
116
|
+
const base = typeof options === 'function' ? options(chainId) : options;
|
|
117
|
+
const transport = config.transports?.[chainId];
|
|
118
|
+
const chain = config.chains.find((entry) => entry.id === chainId);
|
|
119
|
+
return {
|
|
120
|
+
...base,
|
|
121
|
+
...(chain ? { chain } : {}),
|
|
122
|
+
...(transport ? { transport } : {}),
|
|
123
|
+
};
|
|
118
124
|
}),
|
|
119
125
|
// Holds the instance's context, through which a session without an access key receives its
|
|
120
126
|
// account.
|
|
@@ -166,7 +172,7 @@ export function wagmi(options = {}) {
|
|
|
166
172
|
const { chainId } = instance.config;
|
|
167
173
|
const chain = chains.find((entry) => entry.id === chainId);
|
|
168
174
|
if (!chain)
|
|
169
|
-
throw new Error(`Invalid chain: ${chainId} is not
|
|
175
|
+
throw new Error(`Invalid chain: ${chainId} is not a Tempo chain, and the viem plugin's options name no \`chain\`. Return its definition as \`chain\`.`);
|
|
170
176
|
// The connector's chain is the config's first. The instance's namespaces come in the order
|
|
171
177
|
// of `plugins`, so the first namespace that signs in without input signs in at `connect`.
|
|
172
178
|
const ordered = [
|
package/dist/wagmi/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/wagmi/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAGL,YAAY,GACb,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAA;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAE7C,OAAO,KAAK,EAAE,MAAM,UAAU,CAAA;AAC9B,OAAO,KAAK,aAAa,MAAM,8BAA8B,CAAA;AAE7D,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAClE,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AAExC;;;GAGG;AACH,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IAC9B,IAAI,GAAG,+BAA+B,CAAA;IAExD;QACE,KAAK,CACH,qKAAqK,CACtK,CAAA;IACH,CAAC;CACF;AAED,4EAA4E;AAC5E,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IACvB,IAAI,GAAG,wBAAwB,CAAA;IAEjD,YAAY,OAAiC;QAC3C,KAAK,CACH,kBAAkB,OAAO,CAAC,OAAO,kCAAkC,OAAO,CAAC,OAAO,iGAAiG,CACpL,CAAA;IACH,CAAC;CACF;AAWD,oGAAoG;AACpG,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC5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AAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tempoxyz/id",
|
|
3
|
-
"version": "0.0.0-pr-
|
|
3
|
+
"version": "0.0.0-pr-490.sha-3effdd1",
|
|
4
4
|
"description": "Identity and Auth for Tempo",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -41,11 +41,6 @@
|
|
|
41
41
|
"types": "./dist/internal.d.ts",
|
|
42
42
|
"default": "./dist/internal.js"
|
|
43
43
|
},
|
|
44
|
-
"./mpp": {
|
|
45
|
-
"src": "./src/mpp/index.ts",
|
|
46
|
-
"types": "./dist/mpp/index.d.ts",
|
|
47
|
-
"default": "./dist/mpp/index.js"
|
|
48
|
-
},
|
|
49
44
|
"./plugins": {
|
|
50
45
|
"src": "./src/plugins/index.ts",
|
|
51
46
|
"types": "./dist/plugins/index.d.ts",
|
|
@@ -85,7 +80,6 @@
|
|
|
85
80
|
"@wagmi/core": "^3.6.7",
|
|
86
81
|
"expo-secure-store": ">=14",
|
|
87
82
|
"expo-web-browser": ">=14",
|
|
88
|
-
"mppx": ">=0.12",
|
|
89
83
|
"react": ">=18",
|
|
90
84
|
"react-native-get-random-values": ">=1",
|
|
91
85
|
"viem": "^2.57.12"
|
|
@@ -100,9 +94,6 @@
|
|
|
100
94
|
"expo-web-browser": {
|
|
101
95
|
"optional": true
|
|
102
96
|
},
|
|
103
|
-
"mppx": {
|
|
104
|
-
"optional": true
|
|
105
|
-
},
|
|
106
97
|
"react": {
|
|
107
98
|
"optional": true
|
|
108
99
|
},
|
package/src/plugins/index.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* import { Id } from '@tempoxyz/id'
|
|
8
8
|
* import { email, passkey, viem } from '@tempoxyz/id/plugins'
|
|
9
9
|
*
|
|
10
|
-
* const tempoId = Id.create({ plugins: [email(), passkey(), viem({
|
|
10
|
+
* const tempoId = Id.create({ plugins: [email(), passkey(), viem({ chain: tempo })] })
|
|
11
11
|
* ```
|
|
12
12
|
* @module
|
|
13
13
|
*/
|
package/src/plugins/viem.ts
CHANGED
|
@@ -31,6 +31,9 @@ import type * as Session from '../Session.js'
|
|
|
31
31
|
* instance's chain, its transport, and an account that follows the instance's session.
|
|
32
32
|
* `tempoId.viem({ … })` returns a client with overrides, such as another chain, or a fixed `session`
|
|
33
33
|
* for one request on a backend. Without options, the clients use Tempo's chains and their own RPC.
|
|
34
|
+
* The plugin takes options, or a function that returns the options of a chain by its ID, such as
|
|
35
|
+
* for a transport of each chain. A chain ID is valid when it names a Tempo chain, or when its
|
|
36
|
+
* options name a `chain` of that ID.
|
|
34
37
|
*
|
|
35
38
|
* The access key signs transactions. On a page, the account's owner signs messages and typed data:
|
|
36
39
|
* the cloud wallet through Tempo ID, or the account's passkey. Elsewhere, and for a fixed session,
|
|
@@ -48,18 +51,29 @@ import type * as Session from '../Session.js'
|
|
|
48
51
|
* await tempoId.viem({ session }).token.transferSync({ amount, to, token })
|
|
49
52
|
* ```
|
|
50
53
|
*/
|
|
51
|
-
export function viem(options: viem.Options = {}) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
owner = typeof document !== 'undefined',
|
|
56
|
-
transports = {},
|
|
57
|
-
...defaults
|
|
58
|
-
} = options
|
|
54
|
+
export function viem(options: viem.Options | viem.Resolver = {}) {
|
|
55
|
+
/** Returns the options of the chain of `chainId`. */
|
|
56
|
+
const resolve = (chainId: number) =>
|
|
57
|
+
typeof options === 'function' ? options(chainId) : options
|
|
59
58
|
|
|
60
59
|
const plugin = Plugin.from({
|
|
61
60
|
actions: (context) => {
|
|
62
61
|
const { config } = context
|
|
62
|
+
|
|
63
|
+
/** Returns the chain of `chainId`: its options' `chain`, or Tempo's chain of that ID. */
|
|
64
|
+
function chainOf(chainId: number) {
|
|
65
|
+
const { chain } = resolve(chainId)
|
|
66
|
+
if (chain?.id === chainId) return chain
|
|
67
|
+
return defaultChains.find((entry) => entry.id === chainId)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// The wagmi plugin's config holds Tempo's chains, and the instance's chain when it is another.
|
|
71
|
+
const tempoChains = defaultChains.map((entry) => chainOf(entry.id)!)
|
|
72
|
+
const instanceChain = chainOf(config.chainId)
|
|
73
|
+
const chains = (instanceChain &&
|
|
74
|
+
!tempoChains.some((entry) => entry.id === instanceChain.id)
|
|
75
|
+
? [instanceChain, ...tempoChains]
|
|
76
|
+
: tempoChains) as unknown as readonly [Chain, ...Chain[]]
|
|
63
77
|
// The account of each session on each chain, so a client rebuilds no access key at each read.
|
|
64
78
|
const accounts = new WeakMap<
|
|
65
79
|
Session.Session,
|
|
@@ -70,12 +84,24 @@ export function viem(options: viem.Options = {}) {
|
|
|
70
84
|
// The plugin's chains and transports, which the clients and the wagmi plugin share.
|
|
71
85
|
const own = {
|
|
72
86
|
chains,
|
|
73
|
-
transport: (chainId: number) =>
|
|
74
|
-
(typeof
|
|
75
|
-
|
|
76
|
-
|
|
87
|
+
transport: (chainId: number) => {
|
|
88
|
+
if (typeof options === 'function')
|
|
89
|
+
return options(chainId).transport ?? http()
|
|
90
|
+
// The object form names one chain: its `chain`, or the instance's chain. Other chains keep
|
|
91
|
+
// their own RPC, so one transport never serves another chain's requests.
|
|
92
|
+
const target = options.chain?.id ?? config.chainId
|
|
93
|
+
return (chainId === target ? options.transport : undefined) ?? http()
|
|
94
|
+
},
|
|
77
95
|
} satisfies viem.Settings
|
|
78
96
|
|
|
97
|
+
/**
|
|
98
|
+
* Returns whether the account's owner signs on `chainId`. A page holds the user's Tempo ID
|
|
99
|
+
* session, through which the account's owner signs.
|
|
100
|
+
*/
|
|
101
|
+
function owner(chainId: number) {
|
|
102
|
+
return resolve(chainId).owner ?? typeof document !== 'undefined'
|
|
103
|
+
}
|
|
104
|
+
|
|
79
105
|
/**
|
|
80
106
|
* Returns a live access token of `session`, refreshed through the instance when it expires
|
|
81
107
|
* within the margin. Returns `undefined` when the instance holds another user's session.
|
|
@@ -100,7 +126,7 @@ export function viem(options: viem.Options = {}) {
|
|
|
100
126
|
Signer.fromSession(config, session, {
|
|
101
127
|
accessToken: () => accessToken(session),
|
|
102
128
|
chainId,
|
|
103
|
-
owner,
|
|
129
|
+
owner: owner(chainId),
|
|
104
130
|
}),
|
|
105
131
|
)
|
|
106
132
|
return byChain.get(chainId)
|
|
@@ -114,10 +140,10 @@ export function viem(options: viem.Options = {}) {
|
|
|
114
140
|
transport,
|
|
115
141
|
...clientOptions
|
|
116
142
|
} = overrides
|
|
117
|
-
const chain =
|
|
143
|
+
const chain = chainOf(chainId)
|
|
118
144
|
if (!chain)
|
|
119
145
|
throw new Error(
|
|
120
|
-
`Invalid chain: ${chainId} is not
|
|
146
|
+
`Invalid chain: ${chainId} is not a Tempo chain, and its options name no \`chain\`. Return its definition as \`chain\`.`,
|
|
121
147
|
)
|
|
122
148
|
const account = (() => {
|
|
123
149
|
if (!session) return Signer.live(() => current(chainId))
|
|
@@ -129,6 +155,12 @@ export function viem(options: viem.Options = {}) {
|
|
|
129
155
|
if (!fixed) throw new KeyRequiredError()
|
|
130
156
|
return fixed
|
|
131
157
|
})()
|
|
158
|
+
const {
|
|
159
|
+
chain: _chain,
|
|
160
|
+
owner: _owner,
|
|
161
|
+
transport: _transport,
|
|
162
|
+
...defaults
|
|
163
|
+
} = resolve(chainId)
|
|
132
164
|
const client = build({
|
|
133
165
|
...defaults,
|
|
134
166
|
...clientOptions,
|
|
@@ -189,13 +221,17 @@ export function viem(options: viem.Options = {}) {
|
|
|
189
221
|
// whose account follows the session, so `tempoId.token.transferSync()` sends as
|
|
190
222
|
// `tempoId.viem.token.transferSync()` does.
|
|
191
223
|
extend: (instance: Id.Id) => {
|
|
192
|
-
const namespace = (
|
|
224
|
+
const namespace = (
|
|
225
|
+
instance as unknown as {
|
|
226
|
+
viem: viem.Namespace & { [settings]: viem.Settings }
|
|
227
|
+
}
|
|
228
|
+
).viem
|
|
193
229
|
// A client on the first chain names the actions, since the instance's chain may be one that
|
|
194
230
|
// only a call's overrides reach. Each member reads the default client at its use. The sample
|
|
195
231
|
// sends no request, so its transport needs no URL, and a chain without one still builds.
|
|
196
232
|
const sample = build({
|
|
197
233
|
account: Signer.live(() => undefined),
|
|
198
|
-
chain: chains[0],
|
|
234
|
+
chain: namespace[settings].chains[0],
|
|
199
235
|
transport: custom({ request: () => Promise.resolve(undefined) }),
|
|
200
236
|
})
|
|
201
237
|
const members = {}
|
|
@@ -220,10 +256,11 @@ export declare namespace viem {
|
|
|
220
256
|
'account' | 'chain' | 'testnet' | 'transport'
|
|
221
257
|
> & {
|
|
222
258
|
/**
|
|
223
|
-
* The
|
|
224
|
-
* Tempo mainnet, testnet, devnet,
|
|
259
|
+
* The chain of the options' chain ID, such as one with a `feeToken` or another RPC URL. A chain of
|
|
260
|
+
* another ID does not apply. Defaults to Tempo's chain of the ID: mainnet, testnet, devnet, or a
|
|
261
|
+
* local node.
|
|
225
262
|
*/
|
|
226
|
-
|
|
263
|
+
chain?: Chain | undefined
|
|
227
264
|
/**
|
|
228
265
|
* Whether the account's owner signs messages and typed data, through the user's Tempo ID
|
|
229
266
|
* session: the cloud wallet through Tempo ID, or the account's passkey. Defaults to `true` on a
|
|
@@ -232,21 +269,24 @@ export declare namespace viem {
|
|
|
232
269
|
*/
|
|
233
270
|
owner?: boolean | undefined
|
|
234
271
|
/**
|
|
235
|
-
* The transport of
|
|
236
|
-
* the chain's own RPC.
|
|
272
|
+
* The transport of the chain's clients. In the object form, it applies to the options' `chain`,
|
|
273
|
+
* or to the instance's chain without one. Defaults to `http()`, the chain's own RPC.
|
|
237
274
|
*/
|
|
238
|
-
|
|
239
|
-
| Readonly<Record<number, Transport>>
|
|
240
|
-
| ((chainId: number) => Transport | undefined)
|
|
241
|
-
| undefined
|
|
275
|
+
transport?: Transport | undefined
|
|
242
276
|
}
|
|
243
277
|
|
|
278
|
+
/** Returns the options of the chain of `chainId`. */
|
|
279
|
+
type Resolver = (chainId: number) => Options
|
|
280
|
+
|
|
244
281
|
/** The overrides of a client, for one call. */
|
|
245
282
|
type Overrides = Omit<
|
|
246
283
|
NonNullable<Parameters<typeof createClient>[0]>,
|
|
247
284
|
'account' | 'chain' | 'testnet'
|
|
248
285
|
> & {
|
|
249
|
-
/**
|
|
286
|
+
/**
|
|
287
|
+
* The chain ID: a Tempo chain, or one whose options name its `chain`. Defaults to the instance's
|
|
288
|
+
* `chainId`.
|
|
289
|
+
*/
|
|
250
290
|
chainId?: number | undefined
|
|
251
291
|
/**
|
|
252
292
|
* A fixed session, such as one that `tempoId.backend.get` returns, whose access key signs. A
|
|
@@ -285,9 +325,9 @@ export declare namespace viem {
|
|
|
285
325
|
|
|
286
326
|
/** The chains and transports of the plugin, which `tempoId.viem[settings]` returns. */
|
|
287
327
|
type Settings = {
|
|
288
|
-
/**
|
|
328
|
+
/** Tempo's chains, with the instance's chain first when it is another, each from its options. */
|
|
289
329
|
chains: readonly [Chain, ...Chain[]]
|
|
290
|
-
/** Returns the transport of the chain of `chainId`, or `http()` when
|
|
330
|
+
/** Returns the transport of the chain of `chainId`, or `http()` when its options hold none. */
|
|
291
331
|
transport: (chainId: number) => Transport
|
|
292
332
|
}
|
|
293
333
|
|
|
@@ -307,6 +347,9 @@ export const settings = Symbol('viem.settings')
|
|
|
307
347
|
*/
|
|
308
348
|
export const pluginOptions = Symbol('viem.options')
|
|
309
349
|
|
|
350
|
+
/** Tempo's chains, which a chain ID without a `chain` in its options uses. */
|
|
351
|
+
const defaultChains = [tempo, tempoTestnet, tempoDevnet, tempoLocalnet] as const
|
|
352
|
+
|
|
310
353
|
/** The time before a token's expiry at which the owner's account read refreshes it, in milliseconds. */
|
|
311
354
|
const refreshMargin = 30_000
|
|
312
355
|
|
package/src/wagmi/index.ts
CHANGED
|
@@ -131,7 +131,7 @@ export function tempoId<const plugins extends readonly Plugin.Option[] = []>(
|
|
|
131
131
|
// which takes the config's `chains` and `transports` in their place.
|
|
132
132
|
const flattened = Plugin.flatten(entries)
|
|
133
133
|
const own = flattened.find((plugin) => plugin.id === 'viem') as
|
|
134
|
-
| { [pluginOptions]?: viem.Options | undefined }
|
|
134
|
+
| { [pluginOptions]?: viem.Options | viem.Resolver | undefined }
|
|
135
135
|
| undefined
|
|
136
136
|
const others = flattened.filter((plugin) => plugin !== own)
|
|
137
137
|
|
|
@@ -151,12 +151,21 @@ export function tempoId<const plugins extends readonly Plugin.Option[] = []>(
|
|
|
151
151
|
chainId: config.chains[0].id,
|
|
152
152
|
plugins: [
|
|
153
153
|
others,
|
|
154
|
-
viem({
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
154
|
+
viem((chainId) => {
|
|
155
|
+
const options = own?.[pluginOptions]
|
|
156
|
+
const base =
|
|
157
|
+
typeof options === 'function' ? options(chainId) : options
|
|
158
|
+
const transport = (
|
|
159
|
+
config.transports as
|
|
160
|
+
| Readonly<Record<number, Transport>>
|
|
161
|
+
| undefined
|
|
162
|
+
)?.[chainId]
|
|
163
|
+
const chain = config.chains.find((entry) => entry.id === chainId)
|
|
164
|
+
return {
|
|
165
|
+
...base,
|
|
166
|
+
...(chain ? { chain } : {}),
|
|
167
|
+
...(transport ? { transport } : {}),
|
|
168
|
+
}
|
|
160
169
|
}),
|
|
161
170
|
// Holds the instance's context, through which a session without an access key receives its
|
|
162
171
|
// account.
|
|
@@ -294,7 +303,7 @@ export function wagmi(options: wagmi.Options = {}) {
|
|
|
294
303
|
const chain = chains.find((entry) => entry.id === chainId)
|
|
295
304
|
if (!chain)
|
|
296
305
|
throw new Error(
|
|
297
|
-
`Invalid chain: ${chainId} is not
|
|
306
|
+
`Invalid chain: ${chainId} is not a Tempo chain, and the viem plugin's options name no \`chain\`. Return its definition as \`chain\`.`,
|
|
298
307
|
)
|
|
299
308
|
// The connector's chain is the config's first. The instance's namespaces come in the order
|
|
300
309
|
// of `plugins`, so the first namespace that signs in without input signs in at `connect`.
|
package/dist/mpp/index.d.ts
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The entry for MPP: `mpp`, a plugin that adds `tempoId.mpp`, which pays the 402 challenges of
|
|
3
|
-
* Machine Payments Protocol (MPP) endpoints with the session's access key, through mppx.
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* ```ts
|
|
7
|
-
* import { Id } from '@tempoxyz/id'
|
|
8
|
-
* import { mpp } from '@tempoxyz/id/mpp'
|
|
9
|
-
* import { dialog } from '@tempoxyz/id/plugins'
|
|
10
|
-
*
|
|
11
|
-
* const tempoId = Id.create({ accessKey, plugins: [dialog(), mpp()] })
|
|
12
|
-
*
|
|
13
|
-
* await tempoId.dialog.signIn()
|
|
14
|
-
* const response = await tempoId.mpp.fetch('https://api.example.com/fortune')
|
|
15
|
-
* ```
|
|
16
|
-
* @module
|
|
17
|
-
*/
|
|
18
|
-
import { tempo } from 'mppx/client';
|
|
19
|
-
import * as Plugin from '../Plugin.js';
|
|
20
|
-
import type * as Session from '../Session.js';
|
|
21
|
-
/** A charge costs more than `maxAmount`, so the payer signs nothing. */
|
|
22
|
-
export declare class MaxAmountError extends Error {
|
|
23
|
-
readonly name = "mpp.MaxAmountError";
|
|
24
|
-
constructor(options: MaxAmountError.Options);
|
|
25
|
-
}
|
|
26
|
-
export declare namespace MaxAmountError {
|
|
27
|
-
type Options = {
|
|
28
|
-
/** The charge's amount, in the units of its token. */
|
|
29
|
-
amount: string;
|
|
30
|
-
/** The most that a charge may cost, in the units of its token. */
|
|
31
|
-
maxAmount: string;
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Returns the plugin of MPP payments, which adds `tempoId.mpp`. `tempoId.mpp.fetch` is `fetch`
|
|
36
|
-
* that pays each charge an endpoint challenges for, and `tempoId.mpp.session()` returns a session
|
|
37
|
-
* manager, which pays each request of a channel with a voucher. The access key of the instance's
|
|
38
|
-
* session signs every payment, so no payment reaches the account's owner. `tempoId.mpp({ session })`
|
|
39
|
-
* pays with a fixed session's access key, such as one that `tempoId.backend.get` returns.
|
|
40
|
-
*
|
|
41
|
-
* The plugin reads the chains and transports of the `viem` plugin, or of a `viem` plugin of its
|
|
42
|
-
* own without one in `plugins`. `mppx` is an optional peer dependency of `@tempoxyz/id`.
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* ```ts
|
|
46
|
-
* const tempoId = Id.create({ accessKey, plugins: [dialog(), mpp()] })
|
|
47
|
-
*
|
|
48
|
-
* const response = await tempoId.mpp.fetch('https://api.example.com/fortune')
|
|
49
|
-
*
|
|
50
|
-
* const session = tempoId.mpp.session()
|
|
51
|
-
* await session.fetch('https://api.example.com/content')
|
|
52
|
-
* await session.close()
|
|
53
|
-
* ```
|
|
54
|
-
*/
|
|
55
|
-
export declare function mpp(options?: mpp.Options): Plugin.Plugin<"mpp", unknown, {
|
|
56
|
-
mpp: mpp.Namespace;
|
|
57
|
-
}>;
|
|
58
|
-
export declare namespace mpp {
|
|
59
|
-
type Options = Settings & {
|
|
60
|
-
/** Sends each request to an endpoint, and its paid retry. Defaults to the global `fetch`. */
|
|
61
|
-
fetch?: typeof globalThis.fetch | undefined;
|
|
62
|
-
};
|
|
63
|
-
/** The settings of the payments, which the plugin's options set and a call overrides. */
|
|
64
|
-
type Settings = {
|
|
65
|
-
/**
|
|
66
|
-
* The most that a charge may cost, in the units of its token, such as `'0.1'`. A larger charge
|
|
67
|
-
* throws `mpp.MaxAmountError` before the access key signs. Defaults to no maximum, within the
|
|
68
|
-
* access key's token limits.
|
|
69
|
-
*/
|
|
70
|
-
maxAmount?: string | undefined;
|
|
71
|
-
/**
|
|
72
|
-
* The most that a session's channel holds, in the units of its token, such as `'0.05'`. It
|
|
73
|
-
* caps the deposit that an endpoint suggests and each top-up. Defaults to the deposit that the
|
|
74
|
-
* endpoint suggests, within the access key's token limits.
|
|
75
|
-
*/
|
|
76
|
-
maxDeposit?: string | undefined;
|
|
77
|
-
/**
|
|
78
|
-
* Who broadcasts a charge's transaction: the endpoint (`'pull'`) or the app (`'push'`).
|
|
79
|
-
* Defaults to `'pull'`.
|
|
80
|
-
*/
|
|
81
|
-
mode?: 'pull' | 'push' | undefined;
|
|
82
|
-
};
|
|
83
|
-
/** The overrides of a payer, for one call. */
|
|
84
|
-
type Overrides = Settings & {
|
|
85
|
-
/**
|
|
86
|
-
* A fixed session, such as one that `tempoId.backend.get` returns, whose access key pays.
|
|
87
|
-
* Defaults to the instance's session, read at each payment.
|
|
88
|
-
*/
|
|
89
|
-
session?: Session.Session | undefined;
|
|
90
|
-
};
|
|
91
|
-
/** The payments of one access key. */
|
|
92
|
-
type Payer = {
|
|
93
|
-
/**
|
|
94
|
-
* Sends a request, and pays a 402 charge challenge with the access key, then returns the
|
|
95
|
-
* endpoint's response to the paid retry. Throws `Id.SignedOutError` without a session, and
|
|
96
|
-
* `Id.KeyRequiredError` for a session without an access key.
|
|
97
|
-
*/
|
|
98
|
-
fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
99
|
-
/**
|
|
100
|
-
* Returns a session manager of mppx, which opens a channel on the first request of a session
|
|
101
|
-
* endpoint, pays each request with a voucher of the access key, and closes the channel at
|
|
102
|
-
* `close()`. The manager holds the channel in memory, so close it before it is discarded.
|
|
103
|
-
*/
|
|
104
|
-
session: (parameters?: Omit<Parameters<typeof tempo.session.manager>[0], 'account' | 'client' | 'getClient'>) => ReturnType<typeof tempo.session.manager>;
|
|
105
|
-
};
|
|
106
|
-
/** `tempoId.mpp`: the payer of the instance's session, which a call fixes to another session. */
|
|
107
|
-
type Namespace = Payer & ((overrides?: Overrides) => Payer);
|
|
108
|
-
}
|
|
109
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/mpp/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mpp/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAQ,KAAK,E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W,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;QAC1E;;;;WAIG;QACH,OAAO,EAAE,CACP,UAAU,CAAC,EAAE,IAAI,CACf,UAAU,CAAC,OAAO,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAC3C,SAAS,GAAG,QAAQ,GAAG,WAAW,CACnC,KACE,UAAU,CAAC,OAAO,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;KAC9C,CAAA;IAED,iGAAiG;IACjG,KAAK,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC,SAAS,CAAC,EAAE,SAAS,KAAK,KAAK,CAAC,CAAA;CAC5D"}
|
package/dist/mpp/index.js
DELETED
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The entry for MPP: `mpp`, a plugin that adds `tempoId.mpp`, which pays the 402 challenges of
|
|
3
|
-
* Machine Payments Protocol (MPP) endpoints with the session's access key, through mppx.
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* ```ts
|
|
7
|
-
* import { Id } from '@tempoxyz/id'
|
|
8
|
-
* import { mpp } from '@tempoxyz/id/mpp'
|
|
9
|
-
* import { dialog } from '@tempoxyz/id/plugins'
|
|
10
|
-
*
|
|
11
|
-
* const tempoId = Id.create({ accessKey, plugins: [dialog(), mpp()] })
|
|
12
|
-
*
|
|
13
|
-
* await tempoId.dialog.signIn()
|
|
14
|
-
* const response = await tempoId.mpp.fetch('https://api.example.com/fortune')
|
|
15
|
-
* ```
|
|
16
|
-
* @module
|
|
17
|
-
*/
|
|
18
|
-
import { Mppx, tempo } from 'mppx/client';
|
|
19
|
-
import { createClient, formatUnits, parseUnits } from 'viem';
|
|
20
|
-
import * as AccessKey from '../AccessKey.js';
|
|
21
|
-
import * as Id from '../Id.js';
|
|
22
|
-
import * as Plugin from '../Plugin.js';
|
|
23
|
-
import { settings, viem } from '../plugins/viem.js';
|
|
24
|
-
/** A charge costs more than `maxAmount`, so the payer signs nothing. */
|
|
25
|
-
export class MaxAmountError extends Error {
|
|
26
|
-
name = 'mpp.MaxAmountError';
|
|
27
|
-
constructor(options) {
|
|
28
|
-
super(`The charge of ${options.amount} exceeds the \`maxAmount\` of ${options.maxAmount}. Raise \`maxAmount\` to pay it.`);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Returns the plugin of MPP payments, which adds `tempoId.mpp`. `tempoId.mpp.fetch` is `fetch`
|
|
33
|
-
* that pays each charge an endpoint challenges for, and `tempoId.mpp.session()` returns a session
|
|
34
|
-
* manager, which pays each request of a channel with a voucher. The access key of the instance's
|
|
35
|
-
* session signs every payment, so no payment reaches the account's owner. `tempoId.mpp({ session })`
|
|
36
|
-
* pays with a fixed session's access key, such as one that `tempoId.backend.get` returns.
|
|
37
|
-
*
|
|
38
|
-
* The plugin reads the chains and transports of the `viem` plugin, or of a `viem` plugin of its
|
|
39
|
-
* own without one in `plugins`. `mppx` is an optional peer dependency of `@tempoxyz/id`.
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* ```ts
|
|
43
|
-
* const tempoId = Id.create({ accessKey, plugins: [dialog(), mpp()] })
|
|
44
|
-
*
|
|
45
|
-
* const response = await tempoId.mpp.fetch('https://api.example.com/fortune')
|
|
46
|
-
*
|
|
47
|
-
* const session = tempoId.mpp.session()
|
|
48
|
-
* await session.fetch('https://api.example.com/content')
|
|
49
|
-
* await session.close()
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
52
|
-
export function mpp(options = {}) {
|
|
53
|
-
const { fetch } = options;
|
|
54
|
-
// The context of each instance, by its configuration, since an app can pass one plugin to
|
|
55
|
-
// several instances.
|
|
56
|
-
const contexts = new WeakMap();
|
|
57
|
-
return Plugin.from({
|
|
58
|
-
extend(instance) {
|
|
59
|
-
const context = contexts.get(instance.config);
|
|
60
|
-
const held = instance.viem;
|
|
61
|
-
const namespace = held ?? viem().actions(context);
|
|
62
|
-
const { chains, transport } = namespace[settings];
|
|
63
|
-
// A client without an account reads the chain and broadcasts. The access key signs.
|
|
64
|
-
const clients = new Map();
|
|
65
|
-
// The payers of each access key, one for each setting of the charges.
|
|
66
|
-
const payers = new WeakMap();
|
|
67
|
-
/** Returns the client of the chain of `chainId`, one of the plugin's chains. */
|
|
68
|
-
function getClient(parameters = {}) {
|
|
69
|
-
const chainId = parameters.chainId ?? instance.config.chainId;
|
|
70
|
-
const existing = clients.get(chainId);
|
|
71
|
-
if (existing)
|
|
72
|
-
return existing;
|
|
73
|
-
const chain = chains.find((entry) => entry.id === chainId);
|
|
74
|
-
if (!chain)
|
|
75
|
-
throw new Error(`Invalid chain: ${chainId} is not one of the viem plugin's \`chains\`. Add its definition to \`chains\`.`);
|
|
76
|
-
const client = createClient({ chain, transport: transport(chainId) });
|
|
77
|
-
clients.set(chainId, client);
|
|
78
|
-
return client;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Returns the payer of the access key of `overrides.session`, or of the instance's session,
|
|
82
|
-
* with the plugin's settings under `overrides`.
|
|
83
|
-
*/
|
|
84
|
-
function payer(overrides) {
|
|
85
|
-
const current = overrides.session ?? context.session.get();
|
|
86
|
-
if (!current)
|
|
87
|
-
throw new Id.SignedOutError();
|
|
88
|
-
if (!current.key)
|
|
89
|
-
throw new Id.KeyRequiredError();
|
|
90
|
-
const maxAmount = overrides.maxAmount ?? options.maxAmount;
|
|
91
|
-
const maxDeposit = overrides.maxDeposit ?? options.maxDeposit;
|
|
92
|
-
const mode = overrides.mode ?? options.mode;
|
|
93
|
-
let byKey = payers.get(current.key);
|
|
94
|
-
if (!byKey)
|
|
95
|
-
payers.set(current.key, (byKey = new Map()));
|
|
96
|
-
const name = [maxAmount, maxDeposit, mode].join('\n');
|
|
97
|
-
const existing = byKey.get(name);
|
|
98
|
-
if (existing)
|
|
99
|
-
return existing;
|
|
100
|
-
const created = create({
|
|
101
|
-
account: AccessKey.toAccount(AccessKey.from(current.key)),
|
|
102
|
-
fetch,
|
|
103
|
-
getClient,
|
|
104
|
-
maxAmount,
|
|
105
|
-
maxDeposit,
|
|
106
|
-
mode,
|
|
107
|
-
});
|
|
108
|
-
byKey.set(name, created);
|
|
109
|
-
return created;
|
|
110
|
-
}
|
|
111
|
-
/** Returns the payer that resolves its access key at each call, as `payer` does. */
|
|
112
|
-
function bind(overrides = {}) {
|
|
113
|
-
return {
|
|
114
|
-
// A missing session or access key rejects the request, as a failed fetch does.
|
|
115
|
-
fetch: async (input, init) => payer(overrides).fetch(input, init),
|
|
116
|
-
session: (parameters) => payer(overrides).session(parameters),
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
return {
|
|
120
|
-
mpp: Object.assign(bind, bind()),
|
|
121
|
-
};
|
|
122
|
-
},
|
|
123
|
-
id: 'mpp',
|
|
124
|
-
setup(value) {
|
|
125
|
-
contexts.set(value.config, value);
|
|
126
|
-
},
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
/** Creates the payer of `account`. */
|
|
130
|
-
function create(options) {
|
|
131
|
-
const { account, fetch, getClient, maxAmount, maxDeposit, mode } = options;
|
|
132
|
-
const mppx = Mppx.create({
|
|
133
|
-
...(fetch ? { fetch } : {}),
|
|
134
|
-
methods: [tempo.charge({ account, getClient, ...(mode ? { mode } : {}) })],
|
|
135
|
-
// The payer reads each charge's amount before the access key signs. A TIP-20 token has 6
|
|
136
|
-
// decimals.
|
|
137
|
-
onChallenge: (challenge) => {
|
|
138
|
-
if (maxAmount === undefined)
|
|
139
|
-
return Promise.resolve(undefined);
|
|
140
|
-
const amount = BigInt(String(challenge.request.amount ?? 0));
|
|
141
|
-
if (amount > parseUnits(maxAmount, 6))
|
|
142
|
-
throw new MaxAmountError({ amount: formatUnits(amount, 6), maxAmount });
|
|
143
|
-
return Promise.resolve(undefined);
|
|
144
|
-
},
|
|
145
|
-
// The payer pays only through its own `fetch`, so the app's other requests stay unchanged.
|
|
146
|
-
polyfill: false,
|
|
147
|
-
});
|
|
148
|
-
return {
|
|
149
|
-
fetch: (input, init) => mppx.fetch(input, init),
|
|
150
|
-
session: (parameters = {}) => tempo.session.manager({
|
|
151
|
-
...(fetch ? { fetch } : {}),
|
|
152
|
-
...(maxDeposit ? { maxDeposit } : {}),
|
|
153
|
-
...parameters,
|
|
154
|
-
account,
|
|
155
|
-
getClient,
|
|
156
|
-
}),
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
//# sourceMappingURL=index.js.map
|
package/dist/mpp/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mpp/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAEzC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AAE5D,OAAO,KAAK,SAAS,MAAM,iBAAiB,CAAA;AAC5C,OAAO,KAAK,EAAE,MAAM,UAAU,CAAA;AAC9B,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAGnD,wEAAwE;AACxE,MAAM,OAAO,cAAe,SAAQ,KAAK;IACrB,IAAI,GAAG,oBAAoB,CAAA;IAE7C,YAAY,OAA+B;QACzC,KAAK,CACH,iBAAiB,OAAO,CAAC,MAAM,iCAAiC,OAAO,CAAC,SAAS,kCAAkC,CACpH,CAAA;IACH,CAAC;CACF;AAWD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,GAAG,CAAC,OAAO,GAAgB,EAAE;IAC3C,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAA;IACzB,0FAA0F;IAC1F,qBAAqB;IACrB,MAAM,QAAQ,GAAG,IAAI,OAAO,EAA6B,CAAA;IAEzD,OAAO,MAAM,CAAC,IAAI,CAAC;QACjB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,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAA;YAC5D,IAAI,MAAM,GAAG,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC;gBACnC,MAAM,IAAI,cAAc,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAA;YACzE,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;QACnC,CAAC;QACD,2FAA2F;QAC3F,QAAQ,EAAE,KAAK;KAChB,CAAC,CAAA;IACF,OAAO;QACL,KAAK,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC;QAC/C,OAAO,EAAE,CAAC,UAAU,GAAG,EAAE,EAAE,EAAE,CAC3B,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;YACpB,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3B,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACrC,GAAG,UAAU;YACb,OAAO;YACP,SAAS;SACV,CAAC;KACL,CAAA;AACH,CAAC"}
|
package/src/mpp/index.ts
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The entry for MPP: `mpp`, a plugin that adds `tempoId.mpp`, which pays the 402 challenges of
|
|
3
|
-
* Machine Payments Protocol (MPP) endpoints with the session's access key, through mppx.
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* ```ts
|
|
7
|
-
* import { Id } from '@tempoxyz/id'
|
|
8
|
-
* import { mpp } from '@tempoxyz/id/mpp'
|
|
9
|
-
* import { dialog } from '@tempoxyz/id/plugins'
|
|
10
|
-
*
|
|
11
|
-
* const tempoId = Id.create({ accessKey, plugins: [dialog(), mpp()] })
|
|
12
|
-
*
|
|
13
|
-
* await tempoId.dialog.signIn()
|
|
14
|
-
* const response = await tempoId.mpp.fetch('https://api.example.com/fortune')
|
|
15
|
-
* ```
|
|
16
|
-
* @module
|
|
17
|
-
*/
|
|
18
|
-
import { Mppx, tempo } from 'mppx/client'
|
|
19
|
-
import type { Chain, Client, Transport } from 'viem'
|
|
20
|
-
import { createClient, formatUnits, parseUnits } from 'viem'
|
|
21
|
-
import type { Account } from 'viem/tempo'
|
|
22
|
-
import * as AccessKey from '../AccessKey.js'
|
|
23
|
-
import * as Id from '../Id.js'
|
|
24
|
-
import * as Plugin from '../Plugin.js'
|
|
25
|
-
import { settings, viem } from '../plugins/viem.js'
|
|
26
|
-
import type * as Session from '../Session.js'
|
|
27
|
-
|
|
28
|
-
/** A charge costs more than `maxAmount`, so the payer signs nothing. */
|
|
29
|
-
export class MaxAmountError extends Error {
|
|
30
|
-
override readonly name = 'mpp.MaxAmountError'
|
|
31
|
-
|
|
32
|
-
constructor(options: MaxAmountError.Options) {
|
|
33
|
-
super(
|
|
34
|
-
`The charge of ${options.amount} exceeds the \`maxAmount\` of ${options.maxAmount}. Raise \`maxAmount\` to pay it.`,
|
|
35
|
-
)
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export declare namespace MaxAmountError {
|
|
40
|
-
type Options = {
|
|
41
|
-
/** The charge's amount, in the units of its token. */
|
|
42
|
-
amount: string
|
|
43
|
-
/** The most that a charge may cost, in the units of its token. */
|
|
44
|
-
maxAmount: string
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Returns the plugin of MPP payments, which adds `tempoId.mpp`. `tempoId.mpp.fetch` is `fetch`
|
|
50
|
-
* that pays each charge an endpoint challenges for, and `tempoId.mpp.session()` returns a session
|
|
51
|
-
* manager, which pays each request of a channel with a voucher. The access key of the instance's
|
|
52
|
-
* session signs every payment, so no payment reaches the account's owner. `tempoId.mpp({ session })`
|
|
53
|
-
* pays with a fixed session's access key, such as one that `tempoId.backend.get` returns.
|
|
54
|
-
*
|
|
55
|
-
* The plugin reads the chains and transports of the `viem` plugin, or of a `viem` plugin of its
|
|
56
|
-
* own without one in `plugins`. `mppx` is an optional peer dependency of `@tempoxyz/id`.
|
|
57
|
-
*
|
|
58
|
-
* @example
|
|
59
|
-
* ```ts
|
|
60
|
-
* const tempoId = Id.create({ accessKey, plugins: [dialog(), mpp()] })
|
|
61
|
-
*
|
|
62
|
-
* const response = await tempoId.mpp.fetch('https://api.example.com/fortune')
|
|
63
|
-
*
|
|
64
|
-
* const session = tempoId.mpp.session()
|
|
65
|
-
* await session.fetch('https://api.example.com/content')
|
|
66
|
-
* await session.close()
|
|
67
|
-
* ```
|
|
68
|
-
*/
|
|
69
|
-
export function mpp(options: mpp.Options = {}) {
|
|
70
|
-
const { fetch } = options
|
|
71
|
-
// The context of each instance, by its configuration, since an app can pass one plugin to
|
|
72
|
-
// several instances.
|
|
73
|
-
const contexts = new WeakMap<Id.Config, Plugin.Context>()
|
|
74
|
-
|
|
75
|
-
return Plugin.from({
|
|
76
|
-
extend(instance: Id.Id) {
|
|
77
|
-
const context = contexts.get(instance.config)!
|
|
78
|
-
const held = (instance as unknown as { viem?: viem.Namespace }).viem
|
|
79
|
-
const namespace = held ?? (viem().actions!(context) as viem.Namespace)
|
|
80
|
-
const { chains, transport } = namespace[
|
|
81
|
-
settings as never
|
|
82
|
-
] as unknown as viem.Settings
|
|
83
|
-
// A client without an account reads the chain and broadcasts. The access key signs.
|
|
84
|
-
const clients = new Map<number, Client<Transport, Chain>>()
|
|
85
|
-
// The payers of each access key, one for each setting of the charges.
|
|
86
|
-
const payers = new WeakMap<AccessKey.AccessKey, Map<string, mpp.Payer>>()
|
|
87
|
-
|
|
88
|
-
/** Returns the client of the chain of `chainId`, one of the plugin's chains. */
|
|
89
|
-
function getClient(parameters: { chainId?: number | undefined } = {}) {
|
|
90
|
-
const chainId = parameters.chainId ?? instance.config.chainId
|
|
91
|
-
const existing = clients.get(chainId)
|
|
92
|
-
if (existing) return existing
|
|
93
|
-
const chain = chains.find((entry) => entry.id === chainId)
|
|
94
|
-
if (!chain)
|
|
95
|
-
throw new Error(
|
|
96
|
-
`Invalid chain: ${chainId} is not one of the viem plugin's \`chains\`. Add its definition to \`chains\`.`,
|
|
97
|
-
)
|
|
98
|
-
const client = createClient({ chain, transport: transport(chainId) })
|
|
99
|
-
clients.set(chainId, client)
|
|
100
|
-
return client
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Returns the payer of the access key of `overrides.session`, or of the instance's session,
|
|
105
|
-
* with the plugin's settings under `overrides`.
|
|
106
|
-
*/
|
|
107
|
-
function payer(overrides: mpp.Overrides) {
|
|
108
|
-
const current = overrides.session ?? context.session.get()
|
|
109
|
-
if (!current) throw new Id.SignedOutError()
|
|
110
|
-
if (!current.key) throw new Id.KeyRequiredError()
|
|
111
|
-
const maxAmount = overrides.maxAmount ?? options.maxAmount
|
|
112
|
-
const maxDeposit = overrides.maxDeposit ?? options.maxDeposit
|
|
113
|
-
const mode = overrides.mode ?? options.mode
|
|
114
|
-
let byKey = payers.get(current.key)
|
|
115
|
-
if (!byKey) payers.set(current.key, (byKey = new Map()))
|
|
116
|
-
const name = [maxAmount, maxDeposit, mode].join('\n')
|
|
117
|
-
const existing = byKey.get(name)
|
|
118
|
-
if (existing) return existing
|
|
119
|
-
|
|
120
|
-
const created = create({
|
|
121
|
-
account: AccessKey.toAccount(AccessKey.from(current.key)),
|
|
122
|
-
fetch,
|
|
123
|
-
getClient,
|
|
124
|
-
maxAmount,
|
|
125
|
-
maxDeposit,
|
|
126
|
-
mode,
|
|
127
|
-
})
|
|
128
|
-
byKey.set(name, created)
|
|
129
|
-
return created
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/** Returns the payer that resolves its access key at each call, as `payer` does. */
|
|
133
|
-
function bind(overrides: mpp.Overrides = {}): mpp.Payer {
|
|
134
|
-
return {
|
|
135
|
-
// A missing session or access key rejects the request, as a failed fetch does.
|
|
136
|
-
fetch: async (input, init) => payer(overrides).fetch(input, init),
|
|
137
|
-
session: (parameters) => payer(overrides).session(parameters),
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
return {
|
|
142
|
-
mpp: Object.assign(bind, bind()) as mpp.Namespace,
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
id: 'mpp',
|
|
146
|
-
setup(value) {
|
|
147
|
-
contexts.set(value.config, value)
|
|
148
|
-
},
|
|
149
|
-
})
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export declare namespace mpp {
|
|
153
|
-
type Options = Settings & {
|
|
154
|
-
/** Sends each request to an endpoint, and its paid retry. Defaults to the global `fetch`. */
|
|
155
|
-
fetch?: typeof globalThis.fetch | undefined
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/** The settings of the payments, which the plugin's options set and a call overrides. */
|
|
159
|
-
type Settings = {
|
|
160
|
-
/**
|
|
161
|
-
* The most that a charge may cost, in the units of its token, such as `'0.1'`. A larger charge
|
|
162
|
-
* throws `mpp.MaxAmountError` before the access key signs. Defaults to no maximum, within the
|
|
163
|
-
* access key's token limits.
|
|
164
|
-
*/
|
|
165
|
-
maxAmount?: string | undefined
|
|
166
|
-
/**
|
|
167
|
-
* The most that a session's channel holds, in the units of its token, such as `'0.05'`. It
|
|
168
|
-
* caps the deposit that an endpoint suggests and each top-up. Defaults to the deposit that the
|
|
169
|
-
* endpoint suggests, within the access key's token limits.
|
|
170
|
-
*/
|
|
171
|
-
maxDeposit?: string | undefined
|
|
172
|
-
/**
|
|
173
|
-
* Who broadcasts a charge's transaction: the endpoint (`'pull'`) or the app (`'push'`).
|
|
174
|
-
* Defaults to `'pull'`.
|
|
175
|
-
*/
|
|
176
|
-
mode?: 'pull' | 'push' | undefined
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/** The overrides of a payer, for one call. */
|
|
180
|
-
type Overrides = Settings & {
|
|
181
|
-
/**
|
|
182
|
-
* A fixed session, such as one that `tempoId.backend.get` returns, whose access key pays.
|
|
183
|
-
* Defaults to the instance's session, read at each payment.
|
|
184
|
-
*/
|
|
185
|
-
session?: Session.Session | undefined
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/** The payments of one access key. */
|
|
189
|
-
type Payer = {
|
|
190
|
-
/**
|
|
191
|
-
* Sends a request, and pays a 402 charge challenge with the access key, then returns the
|
|
192
|
-
* endpoint's response to the paid retry. Throws `Id.SignedOutError` without a session, and
|
|
193
|
-
* `Id.KeyRequiredError` for a session without an access key.
|
|
194
|
-
*/
|
|
195
|
-
fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>
|
|
196
|
-
/**
|
|
197
|
-
* Returns a session manager of mppx, which opens a channel on the first request of a session
|
|
198
|
-
* endpoint, pays each request with a voucher of the access key, and closes the channel at
|
|
199
|
-
* `close()`. The manager holds the channel in memory, so close it before it is discarded.
|
|
200
|
-
*/
|
|
201
|
-
session: (
|
|
202
|
-
parameters?: Omit<
|
|
203
|
-
Parameters<typeof tempo.session.manager>[0],
|
|
204
|
-
'account' | 'client' | 'getClient'
|
|
205
|
-
>,
|
|
206
|
-
) => ReturnType<typeof tempo.session.manager>
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
/** `tempoId.mpp`: the payer of the instance's session, which a call fixes to another session. */
|
|
210
|
-
type Namespace = Payer & ((overrides?: Overrides) => Payer)
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/** Creates the payer of `account`. */
|
|
214
|
-
function create(options: {
|
|
215
|
-
account: Account.AccessKeyAccount
|
|
216
|
-
fetch: typeof globalThis.fetch | undefined
|
|
217
|
-
getClient: (parameters: { chainId?: number | undefined }) => Client
|
|
218
|
-
maxAmount: string | undefined
|
|
219
|
-
maxDeposit: string | undefined
|
|
220
|
-
mode: 'pull' | 'push' | undefined
|
|
221
|
-
}): mpp.Payer {
|
|
222
|
-
const { account, fetch, getClient, maxAmount, maxDeposit, mode } = options
|
|
223
|
-
const mppx = Mppx.create({
|
|
224
|
-
...(fetch ? { fetch } : {}),
|
|
225
|
-
methods: [tempo.charge({ account, getClient, ...(mode ? { mode } : {}) })],
|
|
226
|
-
// The payer reads each charge's amount before the access key signs. A TIP-20 token has 6
|
|
227
|
-
// decimals.
|
|
228
|
-
onChallenge: (challenge) => {
|
|
229
|
-
if (maxAmount === undefined) return Promise.resolve(undefined)
|
|
230
|
-
const amount = BigInt(String(challenge.request.amount ?? 0))
|
|
231
|
-
if (amount > parseUnits(maxAmount, 6))
|
|
232
|
-
throw new MaxAmountError({ amount: formatUnits(amount, 6), maxAmount })
|
|
233
|
-
return Promise.resolve(undefined)
|
|
234
|
-
},
|
|
235
|
-
// The payer pays only through its own `fetch`, so the app's other requests stay unchanged.
|
|
236
|
-
polyfill: false,
|
|
237
|
-
})
|
|
238
|
-
return {
|
|
239
|
-
fetch: (input, init) => mppx.fetch(input, init),
|
|
240
|
-
session: (parameters = {}) =>
|
|
241
|
-
tempo.session.manager({
|
|
242
|
-
...(fetch ? { fetch } : {}),
|
|
243
|
-
...(maxDeposit ? { maxDeposit } : {}),
|
|
244
|
-
...parameters,
|
|
245
|
-
account,
|
|
246
|
-
getClient,
|
|
247
|
-
}),
|
|
248
|
-
}
|
|
249
|
-
}
|