tenzro-sdk 0.1.0
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/LICENSE +201 -0
- package/README.md +107 -0
- package/dist/agent-payments.d.ts +47 -0
- package/dist/agent-payments.d.ts.map +1 -0
- package/dist/agent-payments.js +76 -0
- package/dist/agent-payments.js.map +1 -0
- package/dist/agent.d.ts +177 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +300 -0
- package/dist/agent.js.map +1 -0
- package/dist/ap2.d.ts +54 -0
- package/dist/ap2.d.ts.map +1 -0
- package/dist/ap2.js +88 -0
- package/dist/ap2.js.map +1 -0
- package/dist/app.d.ts +186 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +317 -0
- package/dist/app.js.map +1 -0
- package/dist/bridge.d.ts +64 -0
- package/dist/bridge.d.ts.map +1 -0
- package/dist/bridge.js +93 -0
- package/dist/bridge.js.map +1 -0
- package/dist/canton.d.ts +36 -0
- package/dist/canton.d.ts.map +1 -0
- package/dist/canton.js +46 -0
- package/dist/canton.js.map +1 -0
- package/dist/circuit-breaker.d.ts +35 -0
- package/dist/circuit-breaker.d.ts.map +1 -0
- package/dist/circuit-breaker.js +53 -0
- package/dist/circuit-breaker.js.map +1 -0
- package/dist/client.d.ts +134 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +265 -0
- package/dist/client.js.map +1 -0
- package/dist/compliance.d.ts +83 -0
- package/dist/compliance.d.ts.map +1 -0
- package/dist/compliance.js +74 -0
- package/dist/compliance.js.map +1 -0
- package/dist/config.d.ts +10 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +24 -0
- package/dist/config.js.map +1 -0
- package/dist/contract.d.ts +68 -0
- package/dist/contract.d.ts.map +1 -0
- package/dist/contract.js +59 -0
- package/dist/contract.js.map +1 -0
- package/dist/crypto.d.ts +112 -0
- package/dist/crypto.d.ts.map +1 -0
- package/dist/crypto.js +97 -0
- package/dist/crypto.js.map +1 -0
- package/dist/custody.d.ts +114 -0
- package/dist/custody.d.ts.map +1 -0
- package/dist/custody.js +96 -0
- package/dist/custody.js.map +1 -0
- package/dist/debridge.d.ts +129 -0
- package/dist/debridge.d.ts.map +1 -0
- package/dist/debridge.js +93 -0
- package/dist/debridge.js.map +1 -0
- package/dist/erc7802.d.ts +36 -0
- package/dist/erc7802.d.ts.map +1 -0
- package/dist/erc7802.js +52 -0
- package/dist/erc7802.js.map +1 -0
- package/dist/events.d.ts +112 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +70 -0
- package/dist/events.js.map +1 -0
- package/dist/governance.d.ts +55 -0
- package/dist/governance.d.ts.map +1 -0
- package/dist/governance.js +77 -0
- package/dist/governance.js.map +1 -0
- package/dist/identity.d.ts +102 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +147 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +67 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +85 -0
- package/dist/index.js.map +1 -0
- package/dist/inference.d.ts +27 -0
- package/dist/inference.d.ts.map +1 -0
- package/dist/inference.js +43 -0
- package/dist/inference.js.map +1 -0
- package/dist/marketplace.d.ts +44 -0
- package/dist/marketplace.d.ts.map +1 -0
- package/dist/marketplace.js +74 -0
- package/dist/marketplace.js.map +1 -0
- package/dist/nanopayment.d.ts +53 -0
- package/dist/nanopayment.d.ts.map +1 -0
- package/dist/nanopayment.js +81 -0
- package/dist/nanopayment.js.map +1 -0
- package/dist/nft.d.ts +127 -0
- package/dist/nft.d.ts.map +1 -0
- package/dist/nft.js +99 -0
- package/dist/nft.js.map +1 -0
- package/dist/payment.d.ts +71 -0
- package/dist/payment.d.ts.map +1 -0
- package/dist/payment.js +105 -0
- package/dist/payment.js.map +1 -0
- package/dist/provider.d.ts +351 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +368 -0
- package/dist/provider.js.map +1 -0
- package/dist/rpc.d.ts +35 -0
- package/dist/rpc.d.ts.map +1 -0
- package/dist/rpc.js +127 -0
- package/dist/rpc.js.map +1 -0
- package/dist/settlement.d.ts +52 -0
- package/dist/settlement.d.ts.map +1 -0
- package/dist/settlement.js +86 -0
- package/dist/settlement.js.map +1 -0
- package/dist/skill.d.ts +55 -0
- package/dist/skill.d.ts.map +1 -0
- package/dist/skill.js +79 -0
- package/dist/skill.js.map +1 -0
- package/dist/staking.d.ts +42 -0
- package/dist/staking.d.ts.map +1 -0
- package/dist/staking.js +62 -0
- package/dist/staking.js.map +1 -0
- package/dist/streaming.d.ts +83 -0
- package/dist/streaming.d.ts.map +1 -0
- package/dist/streaming.js +193 -0
- package/dist/streaming.js.map +1 -0
- package/dist/task.d.ts +46 -0
- package/dist/task.d.ts.map +1 -0
- package/dist/task.js +76 -0
- package/dist/task.js.map +1 -0
- package/dist/tee.d.ts +88 -0
- package/dist/tee.d.ts.map +1 -0
- package/dist/tee.js +62 -0
- package/dist/tee.js.map +1 -0
- package/dist/token.d.ts +165 -0
- package/dist/token.d.ts.map +1 -0
- package/dist/token.js +80 -0
- package/dist/token.js.map +1 -0
- package/dist/tool.d.ts +55 -0
- package/dist/tool.d.ts.map +1 -0
- package/dist/tool.js +79 -0
- package/dist/tool.js.map +1 -0
- package/dist/types.d.ts +1318 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +117 -0
- package/dist/types.js.map +1 -0
- package/dist/wallet.d.ts +44 -0
- package/dist/wallet.d.ts.map +1 -0
- package/dist/wallet.js +75 -0
- package/dist/wallet.js.map +1 -0
- package/dist/zk.d.ts +66 -0
- package/dist/zk.d.ts.map +1 -0
- package/dist/zk.js +58 -0
- package/dist/zk.js.map +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { RpcClient } from './rpc';
|
|
2
|
+
import type { ChannelInfo, NanopaymentReceipt, BatchSettlement, CloseResult } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Client for nanopayment channel operations.
|
|
5
|
+
* Supports opening channels, sending individual nanopayments,
|
|
6
|
+
* batch-flushing to on-chain settlement, and channel lifecycle management.
|
|
7
|
+
*/
|
|
8
|
+
export declare class NanopaymentClient {
|
|
9
|
+
private readonly rpc;
|
|
10
|
+
constructor(rpc: RpcClient);
|
|
11
|
+
/**
|
|
12
|
+
* Open a new nanopayment channel.
|
|
13
|
+
* @param payer - Payer address
|
|
14
|
+
* @param payee - Payee address
|
|
15
|
+
* @param deposit - Initial deposit amount (decimal string)
|
|
16
|
+
* @param asset - Asset to use (default: "TNZO")
|
|
17
|
+
* @returns Opened channel information
|
|
18
|
+
*/
|
|
19
|
+
openChannel(payer: string, payee: string, deposit: string, asset?: string): Promise<ChannelInfo>;
|
|
20
|
+
/**
|
|
21
|
+
* Send a nanopayment through an open channel.
|
|
22
|
+
* @param channelId - The channel to send through
|
|
23
|
+
* @param amount - Payment amount (decimal string)
|
|
24
|
+
* @param memo - Optional memo for this payment
|
|
25
|
+
* @returns Nanopayment receipt
|
|
26
|
+
*/
|
|
27
|
+
sendNanopayment(channelId: string, amount: string, memo?: string): Promise<NanopaymentReceipt>;
|
|
28
|
+
/**
|
|
29
|
+
* Flush accumulated nanopayments to on-chain settlement.
|
|
30
|
+
* @param channelId - The channel to flush
|
|
31
|
+
* @returns Batch settlement result with on-chain transaction hash
|
|
32
|
+
*/
|
|
33
|
+
flushBatch(channelId: string): Promise<BatchSettlement>;
|
|
34
|
+
/**
|
|
35
|
+
* Close a nanopayment channel and settle final balances.
|
|
36
|
+
* @param channelId - The channel to close
|
|
37
|
+
* @returns Close result with final settlement details
|
|
38
|
+
*/
|
|
39
|
+
closeChannel(channelId: string): Promise<CloseResult>;
|
|
40
|
+
/**
|
|
41
|
+
* Get details of a nanopayment channel.
|
|
42
|
+
* @param channelId - The channel identifier
|
|
43
|
+
* @returns Channel information
|
|
44
|
+
*/
|
|
45
|
+
getChannel(channelId: string): Promise<ChannelInfo>;
|
|
46
|
+
/**
|
|
47
|
+
* List all nanopayment channels for an address.
|
|
48
|
+
* @param address - The address to query (as payer or payee)
|
|
49
|
+
* @returns Array of channel information
|
|
50
|
+
*/
|
|
51
|
+
listChannels(address: string): Promise<ChannelInfo[]>;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=nanopayment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nanopayment.d.ts","sourceRoot":"","sources":["../src/nanopayment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EACV,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,WAAW,EACZ,MAAM,SAAS,CAAC;AAEjB;;;;GAIG;AACH,qBAAa,iBAAiB;IAChB,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,SAAS;IAE3C;;;;;;;OAOG;IACG,WAAW,CACf,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,KAAK,GAAE,MAAe,GACrB,OAAO,CAAC,WAAW,CAAC;IAMvB;;;;;;OAMG;IACG,eAAe,CACnB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,kBAAkB,CAAC;IAM9B;;;;OAIG;IACG,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAM7D;;;;OAIG;IACG,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAM3D;;;;OAIG;IACG,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAMzD;;;;OAIG;IACG,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;CAK5D"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NanopaymentClient = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Client for nanopayment channel operations.
|
|
6
|
+
* Supports opening channels, sending individual nanopayments,
|
|
7
|
+
* batch-flushing to on-chain settlement, and channel lifecycle management.
|
|
8
|
+
*/
|
|
9
|
+
class NanopaymentClient {
|
|
10
|
+
rpc;
|
|
11
|
+
constructor(rpc) {
|
|
12
|
+
this.rpc = rpc;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Open a new nanopayment channel.
|
|
16
|
+
* @param payer - Payer address
|
|
17
|
+
* @param payee - Payee address
|
|
18
|
+
* @param deposit - Initial deposit amount (decimal string)
|
|
19
|
+
* @param asset - Asset to use (default: "TNZO")
|
|
20
|
+
* @returns Opened channel information
|
|
21
|
+
*/
|
|
22
|
+
async openChannel(payer, payee, deposit, asset = 'TNZO') {
|
|
23
|
+
return this.rpc.call('tenzro_openNanopaymentChannel', [
|
|
24
|
+
{ payer, payee, deposit, asset },
|
|
25
|
+
]);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Send a nanopayment through an open channel.
|
|
29
|
+
* @param channelId - The channel to send through
|
|
30
|
+
* @param amount - Payment amount (decimal string)
|
|
31
|
+
* @param memo - Optional memo for this payment
|
|
32
|
+
* @returns Nanopayment receipt
|
|
33
|
+
*/
|
|
34
|
+
async sendNanopayment(channelId, amount, memo) {
|
|
35
|
+
return this.rpc.call('tenzro_sendNanopayment', [
|
|
36
|
+
{ channel_id: channelId, amount, memo },
|
|
37
|
+
]);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Flush accumulated nanopayments to on-chain settlement.
|
|
41
|
+
* @param channelId - The channel to flush
|
|
42
|
+
* @returns Batch settlement result with on-chain transaction hash
|
|
43
|
+
*/
|
|
44
|
+
async flushBatch(channelId) {
|
|
45
|
+
return this.rpc.call('tenzro_flushNanopaymentBatch', [
|
|
46
|
+
{ channel_id: channelId },
|
|
47
|
+
]);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Close a nanopayment channel and settle final balances.
|
|
51
|
+
* @param channelId - The channel to close
|
|
52
|
+
* @returns Close result with final settlement details
|
|
53
|
+
*/
|
|
54
|
+
async closeChannel(channelId) {
|
|
55
|
+
return this.rpc.call('tenzro_closeNanopaymentChannel', [
|
|
56
|
+
{ channel_id: channelId },
|
|
57
|
+
]);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Get details of a nanopayment channel.
|
|
61
|
+
* @param channelId - The channel identifier
|
|
62
|
+
* @returns Channel information
|
|
63
|
+
*/
|
|
64
|
+
async getChannel(channelId) {
|
|
65
|
+
return this.rpc.call('tenzro_getNanopaymentChannel', [
|
|
66
|
+
{ channel_id: channelId },
|
|
67
|
+
]);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* List all nanopayment channels for an address.
|
|
71
|
+
* @param address - The address to query (as payer or payee)
|
|
72
|
+
* @returns Array of channel information
|
|
73
|
+
*/
|
|
74
|
+
async listChannels(address) {
|
|
75
|
+
return this.rpc.call('tenzro_listNanopaymentChannels', [
|
|
76
|
+
{ address },
|
|
77
|
+
]);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
exports.NanopaymentClient = NanopaymentClient;
|
|
81
|
+
//# sourceMappingURL=nanopayment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nanopayment.js","sourceRoot":"","sources":["../src/nanopayment.ts"],"names":[],"mappings":";;;AAQA;;;;GAIG;AACH,MAAa,iBAAiB;IACC;IAA7B,YAA6B,GAAc;QAAd,QAAG,GAAH,GAAG,CAAW;IAAG,CAAC;IAE/C;;;;;;;OAOG;IACH,KAAK,CAAC,WAAW,CACf,KAAa,EACb,KAAa,EACb,OAAe,EACf,QAAgB,MAAM;QAEtB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAc,+BAA+B,EAAE;YACjE,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE;SACjC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,eAAe,CACnB,SAAiB,EACjB,MAAc,EACd,IAAa;QAEb,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAqB,wBAAwB,EAAE;YACjE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE;SACxC,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,UAAU,CAAC,SAAiB;QAChC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAkB,8BAA8B,EAAE;YACpE,EAAE,UAAU,EAAE,SAAS,EAAE;SAC1B,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,YAAY,CAAC,SAAiB;QAClC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAc,gCAAgC,EAAE;YAClE,EAAE,UAAU,EAAE,SAAS,EAAE;SAC1B,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,UAAU,CAAC,SAAiB;QAChC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAc,8BAA8B,EAAE;YAChE,EAAE,UAAU,EAAE,SAAS,EAAE;SAC1B,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,YAAY,CAAC,OAAe;QAChC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAgB,gCAAgC,EAAE;YACpE,EAAE,OAAO,EAAE;SACZ,CAAC,CAAC;IACL,CAAC;CACF;AAlFD,8CAkFC"}
|
package/dist/nft.d.ts
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import type { RpcClient } from './rpc';
|
|
2
|
+
/** Information about an NFT collection. */
|
|
3
|
+
export interface CollectionInfo {
|
|
4
|
+
/** Unique collection identifier */
|
|
5
|
+
collection_id: string;
|
|
6
|
+
/** Collection name */
|
|
7
|
+
name: string;
|
|
8
|
+
/** Collection ticker symbol */
|
|
9
|
+
symbol: string;
|
|
10
|
+
/** NFT type (e.g. "ERC-721", "ERC-1155") */
|
|
11
|
+
nft_type: string;
|
|
12
|
+
/** Creator address */
|
|
13
|
+
creator: string;
|
|
14
|
+
/** EVM contract address for the collection */
|
|
15
|
+
evm_address: string;
|
|
16
|
+
}
|
|
17
|
+
/** Result of minting an NFT. */
|
|
18
|
+
export interface NftMintResult {
|
|
19
|
+
/** Collection the NFT was minted in */
|
|
20
|
+
collection_id: string;
|
|
21
|
+
/** Token ID of the newly minted NFT */
|
|
22
|
+
token_id: string;
|
|
23
|
+
/** Recipient address */
|
|
24
|
+
recipient: string;
|
|
25
|
+
/** Transaction hash */
|
|
26
|
+
tx_hash?: string;
|
|
27
|
+
}
|
|
28
|
+
/** Information about a specific NFT or collection. */
|
|
29
|
+
export interface NftInfo {
|
|
30
|
+
/** Collection identifier */
|
|
31
|
+
collection_id: string;
|
|
32
|
+
/** Token ID (omitted when querying collection-level info) */
|
|
33
|
+
token_id?: string;
|
|
34
|
+
/** NFT or collection name */
|
|
35
|
+
name: string;
|
|
36
|
+
/** Metadata URI (e.g. IPFS link) */
|
|
37
|
+
metadata_uri?: string;
|
|
38
|
+
/** Current owner address */
|
|
39
|
+
owner?: string;
|
|
40
|
+
}
|
|
41
|
+
/** Result of transferring an NFT. */
|
|
42
|
+
export interface NftTransferResult {
|
|
43
|
+
/** Transaction hash */
|
|
44
|
+
tx_hash: string;
|
|
45
|
+
/** Collection identifier */
|
|
46
|
+
collection_id: string;
|
|
47
|
+
/** Token ID */
|
|
48
|
+
token_id: string;
|
|
49
|
+
/** Sender address */
|
|
50
|
+
from: string;
|
|
51
|
+
/** Recipient address */
|
|
52
|
+
to: string;
|
|
53
|
+
/** Status */
|
|
54
|
+
status: string;
|
|
55
|
+
}
|
|
56
|
+
/** Result of registering a cross-VM pointer for an NFT collection. */
|
|
57
|
+
export interface NftPointerResult {
|
|
58
|
+
/** Collection identifier */
|
|
59
|
+
collection_id: string;
|
|
60
|
+
/** Target VM (e.g. "svm", "daml") */
|
|
61
|
+
target_vm: string;
|
|
62
|
+
/** Pointer address on the target VM */
|
|
63
|
+
target_address: string;
|
|
64
|
+
/** Transaction hash */
|
|
65
|
+
tx_hash?: string;
|
|
66
|
+
/** Status */
|
|
67
|
+
status: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Client for NFT collection and token management.
|
|
71
|
+
* Supports creating collections, minting NFTs, transferring ownership,
|
|
72
|
+
* querying metadata, and registering cross-VM pointers for NFT contracts.
|
|
73
|
+
*/
|
|
74
|
+
export declare class NftClient {
|
|
75
|
+
private readonly rpc;
|
|
76
|
+
constructor(rpc: RpcClient);
|
|
77
|
+
/**
|
|
78
|
+
* Create a new NFT collection via the factory.
|
|
79
|
+
* @param name - Collection name (e.g. "Tenzro Founders")
|
|
80
|
+
* @param symbol - Collection ticker symbol (e.g. "TFNDR")
|
|
81
|
+
* @param nftType - NFT standard type (e.g. "ERC-721", "ERC-1155")
|
|
82
|
+
* @param creator - Creator address
|
|
83
|
+
* @returns Information about the newly created collection
|
|
84
|
+
*/
|
|
85
|
+
createCollection(name: string, symbol: string, nftType: string, creator: string): Promise<CollectionInfo>;
|
|
86
|
+
/**
|
|
87
|
+
* Mint a new NFT in an existing collection.
|
|
88
|
+
* @param collectionId - Collection identifier
|
|
89
|
+
* @param tokenId - Token ID to mint
|
|
90
|
+
* @param recipient - Recipient address
|
|
91
|
+
* @param metadataUri - Metadata URI (e.g. IPFS CID or HTTPS URL)
|
|
92
|
+
* @returns Mint result with token ID and transaction hash
|
|
93
|
+
*/
|
|
94
|
+
mintNft(collectionId: string, tokenId: string, recipient: string, metadataUri: string): Promise<NftMintResult>;
|
|
95
|
+
/**
|
|
96
|
+
* Transfer an NFT from one address to another.
|
|
97
|
+
* @param collectionId - Collection identifier
|
|
98
|
+
* @param tokenId - Token ID to transfer
|
|
99
|
+
* @param from - Current owner address
|
|
100
|
+
* @param to - Recipient address
|
|
101
|
+
* @returns Transfer result with transaction hash
|
|
102
|
+
*/
|
|
103
|
+
transferNft(collectionId: string, tokenId: string, from: string, to: string): Promise<NftTransferResult>;
|
|
104
|
+
/**
|
|
105
|
+
* Get information about a collection or a specific NFT.
|
|
106
|
+
* @param collectionId - Collection identifier
|
|
107
|
+
* @param tokenId - Optional token ID; omit to get collection-level info
|
|
108
|
+
* @returns NFT or collection information
|
|
109
|
+
*/
|
|
110
|
+
getNftInfo(collectionId: string, tokenId?: string): Promise<NftInfo>;
|
|
111
|
+
/**
|
|
112
|
+
* List NFT collections, optionally filtered by creator.
|
|
113
|
+
* @param creator - Optional creator address filter
|
|
114
|
+
* @returns Array of collection information
|
|
115
|
+
*/
|
|
116
|
+
listCollections(creator?: string): Promise<CollectionInfo[]>;
|
|
117
|
+
/**
|
|
118
|
+
* Register a cross-VM pointer for an NFT collection so it can be
|
|
119
|
+
* accessed from another VM (e.g. SVM or DAML) using the Sei V2 pointer model.
|
|
120
|
+
* @param collectionId - Collection identifier
|
|
121
|
+
* @param targetVm - Target VM (e.g. "svm", "daml")
|
|
122
|
+
* @param targetAddress - Pointer address on the target VM
|
|
123
|
+
* @returns Pointer registration result
|
|
124
|
+
*/
|
|
125
|
+
registerPointer(collectionId: string, targetVm: string, targetAddress: string): Promise<NftPointerResult>;
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=nft.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nft.d.ts","sourceRoot":"","sources":["../src/nft.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,2CAA2C;AAC3C,MAAM,WAAW,cAAc;IAC7B,mCAAmC;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,+BAA+B;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,QAA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H,qBAAa,SAAS;IACR,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,SAAS;IAE3C;;;;;;;OAOG;IACG,gBAAgB,CACpB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,cAAc,CAAC;IAM1B;;;;;;;OAOG;IACG,OAAO,CACX,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,aAAa,CAAC;IAWzB;;;;;;;OAOG;IACG,WAAW,CACf,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,iBAAiB,CAAC;IAM7B;;;;;OAKG;IACG,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAM1E;;;;OAIG;IACG,eAAe,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAMlE;;;;;;;OAOG;IACG,eAAe,CACnB,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,gBAAgB,CAAC;CAS7B"}
|
package/dist/nft.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NftClient = void 0;
|
|
4
|
+
// ── Client ──
|
|
5
|
+
/**
|
|
6
|
+
* Client for NFT collection and token management.
|
|
7
|
+
* Supports creating collections, minting NFTs, transferring ownership,
|
|
8
|
+
* querying metadata, and registering cross-VM pointers for NFT contracts.
|
|
9
|
+
*/
|
|
10
|
+
class NftClient {
|
|
11
|
+
rpc;
|
|
12
|
+
constructor(rpc) {
|
|
13
|
+
this.rpc = rpc;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Create a new NFT collection via the factory.
|
|
17
|
+
* @param name - Collection name (e.g. "Tenzro Founders")
|
|
18
|
+
* @param symbol - Collection ticker symbol (e.g. "TFNDR")
|
|
19
|
+
* @param nftType - NFT standard type (e.g. "ERC-721", "ERC-1155")
|
|
20
|
+
* @param creator - Creator address
|
|
21
|
+
* @returns Information about the newly created collection
|
|
22
|
+
*/
|
|
23
|
+
async createCollection(name, symbol, nftType, creator) {
|
|
24
|
+
return this.rpc.call('tenzro_createNftCollection', [
|
|
25
|
+
{ name, symbol, nft_type: nftType, creator },
|
|
26
|
+
]);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Mint a new NFT in an existing collection.
|
|
30
|
+
* @param collectionId - Collection identifier
|
|
31
|
+
* @param tokenId - Token ID to mint
|
|
32
|
+
* @param recipient - Recipient address
|
|
33
|
+
* @param metadataUri - Metadata URI (e.g. IPFS CID or HTTPS URL)
|
|
34
|
+
* @returns Mint result with token ID and transaction hash
|
|
35
|
+
*/
|
|
36
|
+
async mintNft(collectionId, tokenId, recipient, metadataUri) {
|
|
37
|
+
return this.rpc.call('tenzro_mintNft', [
|
|
38
|
+
{
|
|
39
|
+
collection_id: collectionId,
|
|
40
|
+
token_id: tokenId,
|
|
41
|
+
recipient,
|
|
42
|
+
metadata_uri: metadataUri,
|
|
43
|
+
},
|
|
44
|
+
]);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Transfer an NFT from one address to another.
|
|
48
|
+
* @param collectionId - Collection identifier
|
|
49
|
+
* @param tokenId - Token ID to transfer
|
|
50
|
+
* @param from - Current owner address
|
|
51
|
+
* @param to - Recipient address
|
|
52
|
+
* @returns Transfer result with transaction hash
|
|
53
|
+
*/
|
|
54
|
+
async transferNft(collectionId, tokenId, from, to) {
|
|
55
|
+
return this.rpc.call('tenzro_transferNft', [
|
|
56
|
+
{ collection_id: collectionId, token_id: tokenId, from, to },
|
|
57
|
+
]);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Get information about a collection or a specific NFT.
|
|
61
|
+
* @param collectionId - Collection identifier
|
|
62
|
+
* @param tokenId - Optional token ID; omit to get collection-level info
|
|
63
|
+
* @returns NFT or collection information
|
|
64
|
+
*/
|
|
65
|
+
async getNftInfo(collectionId, tokenId) {
|
|
66
|
+
return this.rpc.call('tenzro_getNftInfo', [
|
|
67
|
+
{ collection_id: collectionId, token_id: tokenId },
|
|
68
|
+
]);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* List NFT collections, optionally filtered by creator.
|
|
72
|
+
* @param creator - Optional creator address filter
|
|
73
|
+
* @returns Array of collection information
|
|
74
|
+
*/
|
|
75
|
+
async listCollections(creator) {
|
|
76
|
+
return this.rpc.call('tenzro_listNftCollections', [
|
|
77
|
+
{ creator },
|
|
78
|
+
]);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Register a cross-VM pointer for an NFT collection so it can be
|
|
82
|
+
* accessed from another VM (e.g. SVM or DAML) using the Sei V2 pointer model.
|
|
83
|
+
* @param collectionId - Collection identifier
|
|
84
|
+
* @param targetVm - Target VM (e.g. "svm", "daml")
|
|
85
|
+
* @param targetAddress - Pointer address on the target VM
|
|
86
|
+
* @returns Pointer registration result
|
|
87
|
+
*/
|
|
88
|
+
async registerPointer(collectionId, targetVm, targetAddress) {
|
|
89
|
+
return this.rpc.call('tenzro_registerNftPointer', [
|
|
90
|
+
{
|
|
91
|
+
collection_id: collectionId,
|
|
92
|
+
target_vm: targetVm,
|
|
93
|
+
target_address: targetAddress,
|
|
94
|
+
},
|
|
95
|
+
]);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
exports.NftClient = NftClient;
|
|
99
|
+
//# sourceMappingURL=nft.js.map
|
package/dist/nft.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+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AAC,eAAe,CAAC,OAAgB;QACpC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAmB,2BAA2B,EAAE;YAClE,EAAE,OAAO,EAAE;SACZ,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,eAAe,CACnB,YAAoB,EACpB,QAAgB,EAChB,aAAqB;QAErB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAmB,2BAA2B,EAAE;YAClE;gBACE,aAAa,EAAE,YAAY;gBAC3B,SAAS,EAAE,QAAQ;gBACnB,cAAc,EAAE,aAAa;aAC9B;SACF,CAAC,CAAC;IACL,CAAC;CACF;AA7GD,8BA6GC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { RpcClient } from "./rpc";
|
|
2
|
+
import { PaymentChallenge, PaymentReceipt, PaymentSessionInfo, GatewayInfo } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Client for payment protocol operations (MPP / x402).
|
|
5
|
+
* Supports HTTP 402-based payments with session management.
|
|
6
|
+
*/
|
|
7
|
+
export declare class PaymentClient {
|
|
8
|
+
private rpc;
|
|
9
|
+
constructor(rpc: RpcClient);
|
|
10
|
+
/**
|
|
11
|
+
* Create a payment challenge for a resource.
|
|
12
|
+
* @param resource - Resource identifier (e.g., URL or model ID)
|
|
13
|
+
* @param amount - Payment amount
|
|
14
|
+
* @param asset - Asset identifier (default: "USDC")
|
|
15
|
+
* @param protocol - Payment protocol: "mpp" or "x402" (default: "mpp")
|
|
16
|
+
* @returns Payment challenge
|
|
17
|
+
*/
|
|
18
|
+
createChallenge(resource: string, amount: number, asset?: string, protocol?: string): Promise<PaymentChallenge>;
|
|
19
|
+
/**
|
|
20
|
+
* Pay for a resource using the MPP (Machine Payments Protocol).
|
|
21
|
+
* @param url - Resource URL
|
|
22
|
+
* @param payerDid - Optional payer DID for identity binding
|
|
23
|
+
* @returns Payment receipt
|
|
24
|
+
*/
|
|
25
|
+
payMpp(url: string, payerDid?: string): Promise<PaymentReceipt>;
|
|
26
|
+
/**
|
|
27
|
+
* Pay for a resource using x402 protocol (Coinbase).
|
|
28
|
+
* @param url - Resource URL
|
|
29
|
+
* @param payerDid - Optional payer DID for identity binding
|
|
30
|
+
* @returns Payment receipt
|
|
31
|
+
*/
|
|
32
|
+
payX402(url: string, payerDid?: string): Promise<PaymentReceipt>;
|
|
33
|
+
/**
|
|
34
|
+
* List all payment sessions.
|
|
35
|
+
* @param includeInactive - Include inactive sessions (default: false)
|
|
36
|
+
* @returns Array of session information
|
|
37
|
+
*/
|
|
38
|
+
listSessions(includeInactive?: boolean): Promise<PaymentSessionInfo[]>;
|
|
39
|
+
/**
|
|
40
|
+
* Get a payment receipt by ID.
|
|
41
|
+
* @param receiptId - Receipt identifier
|
|
42
|
+
* @returns Payment receipt
|
|
43
|
+
*/
|
|
44
|
+
getReceipt(receiptId: string): Promise<PaymentReceipt>;
|
|
45
|
+
/**
|
|
46
|
+
* Get payment gateway information.
|
|
47
|
+
* @returns Gateway status and supported protocols/assets
|
|
48
|
+
*/
|
|
49
|
+
gatewayInfo(): Promise<GatewayInfo>;
|
|
50
|
+
/**
|
|
51
|
+
* Pay via Visa TAP protocol.
|
|
52
|
+
* @param credential - Visa TAP payment credential
|
|
53
|
+
* @returns Payment result
|
|
54
|
+
*/
|
|
55
|
+
payVisaTap(credential: any): Promise<any>;
|
|
56
|
+
/**
|
|
57
|
+
* Pay via Mastercard Agent Pay protocol.
|
|
58
|
+
* @param credential - Mastercard payment credential
|
|
59
|
+
* @returns Payment result
|
|
60
|
+
*/
|
|
61
|
+
payMastercard(credential: any): Promise<any>;
|
|
62
|
+
/**
|
|
63
|
+
* Pay for a resource using the AP2 (Agentic Payment Protocol).
|
|
64
|
+
* @param agentDid - The agent's DID authorizing the payment
|
|
65
|
+
* @param url - Resource URL to pay for
|
|
66
|
+
* @param amount - Payment amount (decimal string)
|
|
67
|
+
* @returns Payment receipt
|
|
68
|
+
*/
|
|
69
|
+
payAp2(agentDid: string, url: string, amount: string): Promise<PaymentReceipt>;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=payment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["../src/payment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,WAAW,EACZ,MAAM,SAAS,CAAC;AAEjB;;;GAGG;AACH,qBAAa,aAAa;IACZ,OAAO,CAAC,GAAG;gBAAH,GAAG,EAAE,SAAS;IAElC;;;;;;;OAOG;IACG,eAAe,CACnB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,KAAK,GAAE,MAAe,EACtB,QAAQ,GAAE,MAAc,GACvB,OAAO,CAAC,gBAAgB,CAAC;IAM5B;;;;;OAKG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAMrE;;;;;OAKG;IACG,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAMtE;;;;OAIG;IACG,YAAY,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAM5E;;;;OAIG;IACG,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAM5D;;;OAGG;IACG,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC;IAIzC;;;;OAIG;IACG,UAAU,CAAC,UAAU,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAI/C;;;;OAIG;IACG,aAAa,CAAC,UAAU,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAIlD;;;;;;OAMG;IACG,MAAM,CACV,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,cAAc,CAAC;CAK3B"}
|
package/dist/payment.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PaymentClient = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Client for payment protocol operations (MPP / x402).
|
|
6
|
+
* Supports HTTP 402-based payments with session management.
|
|
7
|
+
*/
|
|
8
|
+
class PaymentClient {
|
|
9
|
+
rpc;
|
|
10
|
+
constructor(rpc) {
|
|
11
|
+
this.rpc = rpc;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Create a payment challenge for a resource.
|
|
15
|
+
* @param resource - Resource identifier (e.g., URL or model ID)
|
|
16
|
+
* @param amount - Payment amount
|
|
17
|
+
* @param asset - Asset identifier (default: "USDC")
|
|
18
|
+
* @param protocol - Payment protocol: "mpp" or "x402" (default: "mpp")
|
|
19
|
+
* @returns Payment challenge
|
|
20
|
+
*/
|
|
21
|
+
async createChallenge(resource, amount, asset = "USDC", protocol = "mpp") {
|
|
22
|
+
return this.rpc.call("tenzro_createPaymentChallenge", [
|
|
23
|
+
{ resource, amount, asset, protocol },
|
|
24
|
+
]);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Pay for a resource using the MPP (Machine Payments Protocol).
|
|
28
|
+
* @param url - Resource URL
|
|
29
|
+
* @param payerDid - Optional payer DID for identity binding
|
|
30
|
+
* @returns Payment receipt
|
|
31
|
+
*/
|
|
32
|
+
async payMpp(url, payerDid) {
|
|
33
|
+
return this.rpc.call("tenzro_payMpp", [
|
|
34
|
+
{ url, payer_did: payerDid },
|
|
35
|
+
]);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Pay for a resource using x402 protocol (Coinbase).
|
|
39
|
+
* @param url - Resource URL
|
|
40
|
+
* @param payerDid - Optional payer DID for identity binding
|
|
41
|
+
* @returns Payment receipt
|
|
42
|
+
*/
|
|
43
|
+
async payX402(url, payerDid) {
|
|
44
|
+
return this.rpc.call("tenzro_payX402", [
|
|
45
|
+
{ url, payer_did: payerDid },
|
|
46
|
+
]);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* List all payment sessions.
|
|
50
|
+
* @param includeInactive - Include inactive sessions (default: false)
|
|
51
|
+
* @returns Array of session information
|
|
52
|
+
*/
|
|
53
|
+
async listSessions(includeInactive) {
|
|
54
|
+
return this.rpc.call("tenzro_listPaymentSessions", [
|
|
55
|
+
{ include_inactive: includeInactive ?? false },
|
|
56
|
+
]);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Get a payment receipt by ID.
|
|
60
|
+
* @param receiptId - Receipt identifier
|
|
61
|
+
* @returns Payment receipt
|
|
62
|
+
*/
|
|
63
|
+
async getReceipt(receiptId) {
|
|
64
|
+
return this.rpc.call("tenzro_getPaymentReceipt", [
|
|
65
|
+
{ receipt_id: receiptId },
|
|
66
|
+
]);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Get payment gateway information.
|
|
70
|
+
* @returns Gateway status and supported protocols/assets
|
|
71
|
+
*/
|
|
72
|
+
async gatewayInfo() {
|
|
73
|
+
return this.rpc.call("tenzro_paymentGatewayInfo");
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Pay via Visa TAP protocol.
|
|
77
|
+
* @param credential - Visa TAP payment credential
|
|
78
|
+
* @returns Payment result
|
|
79
|
+
*/
|
|
80
|
+
async payVisaTap(credential) {
|
|
81
|
+
return this.rpc.call("tenzro_payVisaTap", [credential]);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Pay via Mastercard Agent Pay protocol.
|
|
85
|
+
* @param credential - Mastercard payment credential
|
|
86
|
+
* @returns Payment result
|
|
87
|
+
*/
|
|
88
|
+
async payMastercard(credential) {
|
|
89
|
+
return this.rpc.call("tenzro_payMastercard", [credential]);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Pay for a resource using the AP2 (Agentic Payment Protocol).
|
|
93
|
+
* @param agentDid - The agent's DID authorizing the payment
|
|
94
|
+
* @param url - Resource URL to pay for
|
|
95
|
+
* @param amount - Payment amount (decimal string)
|
|
96
|
+
* @returns Payment receipt
|
|
97
|
+
*/
|
|
98
|
+
async payAp2(agentDid, url, amount) {
|
|
99
|
+
return this.rpc.call("tenzro_payAp2", [
|
|
100
|
+
{ agent_did: agentDid, url, amount },
|
|
101
|
+
]);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
exports.PaymentClient = PaymentClient;
|
|
105
|
+
//# sourceMappingURL=payment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment.js","sourceRoot":"","sources":["../src/payment.ts"],"names":[],"mappings":";;;AAQA;;;GAGG;AACH,MAAa,aAAa;IACJ;IAApB,YAAoB,GAAc;QAAd,QAAG,GAAH,GAAG,CAAW;IAAG,CAAC;IAEtC;;;;;;;OAOG;IACH,KAAK,CAAC,eAAe,CACnB,QAAgB,EAChB,MAAc,EACd,QAAgB,MAAM,EACtB,WAAmB,KAAK;QAExB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAmB,+BAA+B,EAAE;YACtE,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE;SACtC,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CAAC,GAAW,EAAE,QAAiB;QACzC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAiB,eAAe,EAAE;YACpD,EAAE,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE;SAC7B,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,OAAO,CAAC,GAAW,EAAE,QAAiB;QAC1C,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAiB,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