@dainprotocol/service-sdk 2.0.93 → 2.0.95
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/client/api-sdk.d.ts +7 -1
- package/dist/client/api-sdk.js +2 -2
- package/dist/client/api-sdk.js.map +1 -1
- package/dist/client/client-auth.d.ts +38 -0
- package/dist/client/client-auth.js +131 -2
- package/dist/client/client-auth.js.map +1 -1
- package/dist/client/client.d.ts +1 -0
- package/dist/client/client.js +92 -25
- package/dist/client/client.js.map +1 -1
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.js +1 -0
- package/dist/client/index.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/schemaConversion.js +67 -1
- package/dist/lib/schemaConversion.js.map +1 -1
- package/dist/lib/schemaStructure.js +134 -17
- package/dist/lib/schemaStructure.js.map +1 -1
- package/dist/plugins/crypto-plugin.d.ts +26 -0
- package/dist/plugins/crypto-plugin.js +44 -4
- package/dist/plugins/crypto-plugin.js.map +1 -1
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.js +1 -0
- package/dist/plugins/index.js.map +1 -1
- package/dist/protocol/account.d.ts +91 -0
- package/dist/protocol/account.js +3 -0
- package/dist/protocol/account.js.map +1 -0
- package/dist/protocol/grants.d.ts +22 -0
- package/dist/protocol/grants.js +3 -0
- package/dist/protocol/grants.js.map +1 -0
- package/dist/protocol/index.d.ts +8 -0
- package/dist/protocol/index.js +12 -0
- package/dist/protocol/index.js.map +1 -0
- package/dist/protocol/payments.d.ts +53 -0
- package/dist/protocol/payments.js +3 -0
- package/dist/protocol/payments.js.map +1 -0
- package/dist/protocol/permissions.d.ts +21 -0
- package/dist/protocol/permissions.js +3 -0
- package/dist/protocol/permissions.js.map +1 -0
- package/dist/protocol/programs.d.ts +44 -0
- package/dist/protocol/programs.js +46 -0
- package/dist/protocol/programs.js.map +1 -0
- package/dist/protocol/registry.d.ts +41 -0
- package/dist/protocol/registry.js +3 -0
- package/dist/protocol/registry.js.map +1 -0
- package/dist/protocol/runtime.d.ts +15 -0
- package/dist/protocol/runtime.js +3 -0
- package/dist/protocol/runtime.js.map +1 -0
- package/dist/protocol/transactions.d.ts +63 -0
- package/dist/protocol/transactions.js +3 -0
- package/dist/protocol/transactions.js.map +1 -0
- package/dist/service/core.js +9 -0
- package/dist/service/core.js.map +1 -1
- package/dist/service/index.d.ts +1 -0
- package/dist/service/index.js +1 -0
- package/dist/service/index.js.map +1 -1
- package/dist/service/nodeService.js +30 -2
- package/dist/service/nodeService.js.map +1 -1
- package/dist/service/server.js +470 -102
- package/dist/service/server.js.map +1 -1
- package/dist/service/types.d.ts +38 -25
- package/package.json +20 -7
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaseDainPlugin } from './base';
|
|
2
|
+
import type { DainAccountContext, DainActionGrant, DainDataPermissionGrant, DainTransactionEnvelope, SmartAccountExecutionContext } from "../protocol";
|
|
2
3
|
/**
|
|
3
4
|
* Supported blockchain networks:
|
|
4
5
|
* - Layer 1: sol (Solana), eth (Ethereum), btc (Bitcoin)
|
|
@@ -9,17 +10,32 @@ export type BlockchainNetwork = 'eth' | 'sol' | 'arb' | 'base' | 'hyperEvm' | 'b
|
|
|
9
10
|
export interface WalletInfo {
|
|
10
11
|
chain: BlockchainNetwork;
|
|
11
12
|
address: string;
|
|
13
|
+
accountId?: string;
|
|
14
|
+
kind?: "smart_account_vault" | "privy_extension" | "session_signer" | "external_wallet" | "agent_wallet";
|
|
15
|
+
capabilities?: string[];
|
|
12
16
|
}
|
|
13
17
|
export interface UnsignedTransaction {
|
|
14
18
|
id: string;
|
|
15
19
|
encodedTx: string;
|
|
16
20
|
chain: BlockchainNetwork;
|
|
17
21
|
signer: string;
|
|
22
|
+
accountAuthority?: string;
|
|
23
|
+
signatureProvider?: "passkey" | "smart_account" | "session_signer" | "user_wallet";
|
|
24
|
+
payer?: string;
|
|
25
|
+
executionModel?: DainTransactionEnvelope["executionModel"];
|
|
26
|
+
smartAccount?: SmartAccountExecutionContext;
|
|
27
|
+
envelope?: DainTransactionEnvelope;
|
|
28
|
+
actionGrants?: DainActionGrant[];
|
|
29
|
+
dataPermissions?: DainDataPermissionGrant[];
|
|
18
30
|
metadata?: Record<string, unknown>;
|
|
19
31
|
ui?: unknown;
|
|
20
32
|
}
|
|
21
33
|
export interface TransactionSignatureRequest {
|
|
22
34
|
txs: UnsignedTransaction[];
|
|
35
|
+
envelope?: DainTransactionEnvelope;
|
|
36
|
+
smartAccount?: SmartAccountExecutionContext;
|
|
37
|
+
actionGrants?: DainActionGrant[];
|
|
38
|
+
dataPermissions?: DainDataPermissionGrant[];
|
|
23
39
|
executeSimultaneously?: boolean;
|
|
24
40
|
toolsShouldWaitForConfirmation?: boolean;
|
|
25
41
|
ui?: unknown;
|
|
@@ -30,6 +46,9 @@ export interface CryptoPluginConfig {
|
|
|
30
46
|
}
|
|
31
47
|
export interface CryptoPluginInput {
|
|
32
48
|
wallets: WalletInfo[];
|
|
49
|
+
account?: DainAccountContext;
|
|
50
|
+
grants?: DainActionGrant[];
|
|
51
|
+
dataPermissions?: DainDataPermissionGrant[];
|
|
33
52
|
}
|
|
34
53
|
export interface CryptoPluginOutput {
|
|
35
54
|
signatureRequests?: TransactionSignatureRequest[];
|
|
@@ -59,11 +78,18 @@ export declare class CryptoPlugin extends BaseDainPlugin<CryptoPluginConfig, Cry
|
|
|
59
78
|
*/
|
|
60
79
|
getUserWallets(input: any): WalletInfo[];
|
|
61
80
|
getUserWalletForChain(input: any, chain: BlockchainNetwork): string | undefined;
|
|
81
|
+
getDainAccount(input: any): DainAccountContext | undefined;
|
|
82
|
+
getActionGrants(input: any): DainActionGrant[] | undefined;
|
|
83
|
+
getDataPermissions(input: any): DainDataPermissionGrant[] | undefined;
|
|
62
84
|
private ensureTransactionIds;
|
|
63
85
|
private normalizeSignatureRequest;
|
|
64
86
|
createTransactionRequest(transactions: UnsignedTransaction[], options?: {
|
|
65
87
|
executeSimultaneously?: boolean;
|
|
66
88
|
toolsShouldWaitForConfirmation?: boolean;
|
|
89
|
+
envelope?: DainTransactionEnvelope;
|
|
90
|
+
smartAccount?: SmartAccountExecutionContext;
|
|
91
|
+
actionGrants?: DainActionGrant[];
|
|
92
|
+
dataPermissions?: DainDataPermissionGrant[];
|
|
67
93
|
ui?: unknown;
|
|
68
94
|
}): TransactionSignatureRequest;
|
|
69
95
|
createTransaction(transaction: Omit<UnsignedTransaction, 'id'> & {
|
|
@@ -76,12 +76,40 @@ class CryptoPlugin extends base_1.BaseDainPlugin {
|
|
|
76
76
|
getUserWalletForChain(input, chain) {
|
|
77
77
|
return this.getUserWallets(input).find(w => w.chain === chain)?.address;
|
|
78
78
|
}
|
|
79
|
+
getDainAccount(input) {
|
|
80
|
+
return (input?.extraData?.account ??
|
|
81
|
+
input?.DAIN_EXTRA_DATA?.account ??
|
|
82
|
+
input?.account ??
|
|
83
|
+
input?.extraData?.plugins?.[this.id]?.account ??
|
|
84
|
+
input?.plugins?.[this.id]?.account ??
|
|
85
|
+
this.getInputData(input)?.account);
|
|
86
|
+
}
|
|
87
|
+
getActionGrants(input) {
|
|
88
|
+
return (input?.extraData?.grants ??
|
|
89
|
+
input?.DAIN_EXTRA_DATA?.grants ??
|
|
90
|
+
input?.grants ??
|
|
91
|
+
input?.extraData?.plugins?.[this.id]?.grants ??
|
|
92
|
+
input?.plugins?.[this.id]?.grants ??
|
|
93
|
+
this.getInputData(input)?.grants);
|
|
94
|
+
}
|
|
95
|
+
getDataPermissions(input) {
|
|
96
|
+
return (input?.extraData?.dataPermissions ??
|
|
97
|
+
input?.DAIN_EXTRA_DATA?.dataPermissions ??
|
|
98
|
+
input?.dataPermissions ??
|
|
99
|
+
input?.extraData?.plugins?.[this.id]?.dataPermissions ??
|
|
100
|
+
input?.plugins?.[this.id]?.dataPermissions ??
|
|
101
|
+
this.getInputData(input)?.dataPermissions);
|
|
102
|
+
}
|
|
79
103
|
ensureTransactionIds(txs) {
|
|
80
104
|
return txs.map(tx => tx.id ? tx : { ...tx, id: (0, cuid2_1.createId)() });
|
|
81
105
|
}
|
|
82
106
|
normalizeSignatureRequest(req) {
|
|
83
107
|
return {
|
|
84
108
|
txs: this.ensureTransactionIds(req.txs),
|
|
109
|
+
envelope: req.envelope,
|
|
110
|
+
smartAccount: req.smartAccount,
|
|
111
|
+
actionGrants: req.actionGrants,
|
|
112
|
+
dataPermissions: req.dataPermissions,
|
|
85
113
|
executeSimultaneously: req.executeSimultaneously,
|
|
86
114
|
toolsShouldWaitForConfirmation: req.toolsShouldWaitForConfirmation,
|
|
87
115
|
ui: req.ui
|
|
@@ -90,6 +118,10 @@ class CryptoPlugin extends base_1.BaseDainPlugin {
|
|
|
90
118
|
createTransactionRequest(transactions, options) {
|
|
91
119
|
return {
|
|
92
120
|
txs: this.ensureTransactionIds(transactions),
|
|
121
|
+
envelope: options?.envelope,
|
|
122
|
+
smartAccount: options?.smartAccount,
|
|
123
|
+
actionGrants: options?.actionGrants,
|
|
124
|
+
dataPermissions: options?.dataPermissions,
|
|
93
125
|
executeSimultaneously: options?.executeSimultaneously,
|
|
94
126
|
toolsShouldWaitForConfirmation: options?.toolsShouldWaitForConfirmation,
|
|
95
127
|
ui: options?.ui
|
|
@@ -123,15 +155,23 @@ class CryptoPlugin extends base_1.BaseDainPlugin {
|
|
|
123
155
|
const inputWallets = normalizeWallets(input?.wallets);
|
|
124
156
|
const walletMap = new Map();
|
|
125
157
|
for (const wallet of inputWallets) {
|
|
126
|
-
walletMap.set(wallet.chain, wallet
|
|
158
|
+
walletMap.set(wallet.chain, wallet);
|
|
127
159
|
}
|
|
128
160
|
for (const wallet of this.wallets) {
|
|
129
161
|
if (!walletMap.has(wallet.chain)) {
|
|
130
|
-
walletMap.set(wallet.chain, wallet
|
|
162
|
+
walletMap.set(wallet.chain, wallet);
|
|
131
163
|
}
|
|
132
164
|
}
|
|
133
|
-
const combinedWallets = Array.from(walletMap.
|
|
134
|
-
|
|
165
|
+
const combinedWallets = Array.from(walletMap.values());
|
|
166
|
+
const extraData = input?.DAIN_EXTRA_DATA && typeof input.DAIN_EXTRA_DATA === "object"
|
|
167
|
+
? input.DAIN_EXTRA_DATA
|
|
168
|
+
: {};
|
|
169
|
+
return {
|
|
170
|
+
wallets: combinedWallets,
|
|
171
|
+
account: input?.account ?? extraData.account,
|
|
172
|
+
grants: input?.grants ?? extraData.grants,
|
|
173
|
+
dataPermissions: input?.dataPermissions ?? extraData.dataPermissions
|
|
174
|
+
};
|
|
135
175
|
}
|
|
136
176
|
extractSignatureRequests(obj) {
|
|
137
177
|
const requests = obj?.signatureRequests;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crypto-plugin.js","sourceRoot":"","sources":["../../src/plugins/crypto-plugin.ts"],"names":[],"mappings":";;;AAAA,iCAAwC;AACxC,gDAAgD;
|
|
1
|
+
{"version":3,"file":"crypto-plugin.js","sourceRoot":"","sources":["../../src/plugins/crypto-plugin.ts"],"names":[],"mappings":";;;AAAA,iCAAwC;AACxC,gDAAgD;AAqEhD,MAAM,cAAc,GAAwB,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;AAE/G,wEAAwE;AACxE,SAAS,gBAAgB,CAAC,GAAY;IACpC,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC;IACnC,IAAI,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QACnC,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;YACpD,KAAK,EAAE,KAA0B;YACjC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC;SACzB,CAAC,CAAC,CAAC;IACN,CAAC;IACD,OAAO,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CAAC;IAChB,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,KAAU;QAClC,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AA3OD,oCA2OC"}
|
package/dist/plugins/index.d.ts
CHANGED
package/dist/plugins/index.js
CHANGED
|
@@ -7,4 +7,5 @@ tslib_1.__exportStar(require("./base"), exports);
|
|
|
7
7
|
tslib_1.__exportStar(require("./time-plugin"), exports);
|
|
8
8
|
tslib_1.__exportStar(require("./crypto-plugin"), exports);
|
|
9
9
|
tslib_1.__exportStar(require("./citations-plugin"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("../protocol"), exports);
|
|
10
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":";AAAA,6BAA6B;;;AAE7B,kDAAwB;AACxB,iDAAuB;AACvB,wDAA8B;AAC9B,0DAAgC;AAChC,6DAAmC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":";AAAA,6BAA6B;;;AAE7B,kDAAwB;AACxB,iDAAuB;AACvB,wDAA8B;AAC9B,0DAAgC;AAChC,6DAAmC;AACnC,sDAA4B"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { DainActionGrant } from "./grants";
|
|
2
|
+
import type { SMART_ACCOUNT_MEMBER_CATEGORY_BITS, SMART_ACCOUNT_MEMBER_PERMISSION_BITS } from "./programs";
|
|
3
|
+
export type DainAccountType = "dain_account" | "dain_group";
|
|
4
|
+
export type DainAccountState = "reserved" | "funded" | "creating" | "created" | "migration_required" | "suspended";
|
|
5
|
+
export type DainNetwork = "mainnet" | "devnet" | "testnet" | "localnet";
|
|
6
|
+
export type DainSmartAccountPermission = keyof typeof SMART_ACCOUNT_MEMBER_PERMISSION_BITS;
|
|
7
|
+
export type DainSmartAccountMemberCategory = keyof typeof SMART_ACCOUNT_MEMBER_CATEGORY_BITS;
|
|
8
|
+
export interface DainSmartAccountVaultDelegation {
|
|
9
|
+
vaultId: number;
|
|
10
|
+
expirationUnixSeconds: number | string;
|
|
11
|
+
}
|
|
12
|
+
export interface DainSmartAccountMember {
|
|
13
|
+
key: string;
|
|
14
|
+
permissions: DainSmartAccountPermission[];
|
|
15
|
+
categories: DainSmartAccountMemberCategory[];
|
|
16
|
+
permissionMask?: number;
|
|
17
|
+
categoryMask?: number;
|
|
18
|
+
vaultDelegations?: DainSmartAccountVaultDelegation[];
|
|
19
|
+
}
|
|
20
|
+
export interface DainSmartAccountDataPermission {
|
|
21
|
+
organizationId?: number | string;
|
|
22
|
+
agentId?: number;
|
|
23
|
+
key?: string;
|
|
24
|
+
permissionMask: string;
|
|
25
|
+
}
|
|
26
|
+
export type DainLinkedWalletKind = "smart_account_vault" | "privy_extension" | "session_signer" | "external_wallet" | "agent_wallet";
|
|
27
|
+
export interface DainSmartAccountRef {
|
|
28
|
+
chain: "solana";
|
|
29
|
+
network: DainNetwork;
|
|
30
|
+
programId: string;
|
|
31
|
+
pda: string;
|
|
32
|
+
ephemeralKey?: string;
|
|
33
|
+
threshold?: number;
|
|
34
|
+
timeLockSeconds?: number;
|
|
35
|
+
transactionId?: number | string;
|
|
36
|
+
vaults?: Record<string, string>;
|
|
37
|
+
members?: DainSmartAccountMember[];
|
|
38
|
+
dataPermissions?: DainSmartAccountDataPermission[];
|
|
39
|
+
}
|
|
40
|
+
export interface DainLinkedWallet {
|
|
41
|
+
id?: string;
|
|
42
|
+
kind: DainLinkedWalletKind;
|
|
43
|
+
chain: string;
|
|
44
|
+
address: string;
|
|
45
|
+
label?: string;
|
|
46
|
+
capabilities?: string[];
|
|
47
|
+
}
|
|
48
|
+
export interface DainAccountCapabilities {
|
|
49
|
+
solanaSmartAccount?: boolean;
|
|
50
|
+
externalWallets?: boolean;
|
|
51
|
+
externalSessionSigners?: boolean;
|
|
52
|
+
solanaAgentGrants?: boolean;
|
|
53
|
+
groupExternalActions?: boolean;
|
|
54
|
+
registryDiscovery?: boolean;
|
|
55
|
+
dataPermissions?: boolean;
|
|
56
|
+
payments?: boolean;
|
|
57
|
+
[key: string]: unknown;
|
|
58
|
+
}
|
|
59
|
+
export interface DainAccountContext {
|
|
60
|
+
id: string;
|
|
61
|
+
type: DainAccountType;
|
|
62
|
+
state: DainAccountState;
|
|
63
|
+
username?: string;
|
|
64
|
+
smartAccount?: DainSmartAccountRef;
|
|
65
|
+
linkedWallets?: DainLinkedWallet[];
|
|
66
|
+
capabilities?: DainAccountCapabilities;
|
|
67
|
+
}
|
|
68
|
+
export interface DainGroupMemberRef {
|
|
69
|
+
id: string;
|
|
70
|
+
kind: "passkey" | "key" | "user" | "nft" | "agent" | "organization";
|
|
71
|
+
label?: string;
|
|
72
|
+
address?: string;
|
|
73
|
+
weight?: number;
|
|
74
|
+
permissions?: DainSmartAccountPermission[];
|
|
75
|
+
categories?: DainSmartAccountMemberCategory[];
|
|
76
|
+
}
|
|
77
|
+
export interface DainGroupContext extends DainAccountContext {
|
|
78
|
+
type: "dain_group";
|
|
79
|
+
members?: DainGroupMemberRef[];
|
|
80
|
+
threshold?: number;
|
|
81
|
+
}
|
|
82
|
+
export interface DainAuthContext {
|
|
83
|
+
subject: string;
|
|
84
|
+
issuer?: string;
|
|
85
|
+
sessionId?: string;
|
|
86
|
+
scopes?: string[];
|
|
87
|
+
roles?: string[];
|
|
88
|
+
permissions?: string[];
|
|
89
|
+
grants?: DainActionGrant[];
|
|
90
|
+
source?: "dain_id" | "dain_client" | "service" | "api_key";
|
|
91
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/protocol/account.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { DainDataPermissionGrant } from "./permissions";
|
|
2
|
+
import type { DainAgentRegistryRef } from "./registry";
|
|
3
|
+
export type DainGrantStatus = "draft" | "active" | "paused" | "revoked" | "expired";
|
|
4
|
+
export type DainGrantScope = "services.interact" | "data.read" | "data.write" | "tx.build" | "tx.relay" | "wallets.read" | "wallets.sign" | "payments.create" | "payments.claim" | string;
|
|
5
|
+
export interface DainGrantLimit {
|
|
6
|
+
kind: "spend" | "calls" | "period" | "chains" | "tools";
|
|
7
|
+
value: string | number | string[];
|
|
8
|
+
periodSeconds?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface DainActionGrant {
|
|
11
|
+
id: string;
|
|
12
|
+
accountId: string;
|
|
13
|
+
smartAccountPDA?: string;
|
|
14
|
+
status: DainGrantStatus;
|
|
15
|
+
scopes: DainGrantScope[];
|
|
16
|
+
agent?: DainAgentRegistryRef;
|
|
17
|
+
serviceUrl?: string;
|
|
18
|
+
dataPermissions?: DainDataPermissionGrant[];
|
|
19
|
+
limits?: DainGrantLimit[];
|
|
20
|
+
createdAt?: string;
|
|
21
|
+
expiresAt?: string;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grants.js","sourceRoot":"","sources":["../../src/protocol/grants.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./account"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./grants"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./payments"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./permissions"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./programs"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./registry"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./runtime"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./transactions"), exports);
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/protocol/index.ts"],"names":[],"mappings":";;;AAAA,oDAA0B;AAC1B,mDAAyB;AACzB,qDAA2B;AAC3B,wDAA8B;AAC9B,qDAA2B;AAC3B,qDAA2B;AAC3B,oDAA0B;AAC1B,yDAA+B"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { DainAgentRegistryRef } from "./registry";
|
|
2
|
+
import type { SMART_ACCOUNT_PAYMENT_STATUS_BITS, SMART_ACCOUNT_PAYMENT_TYPE } from "./programs";
|
|
3
|
+
export type DainPaymentKind = "one_time" | "pure_subscription" | "hybrid_subscription" | "pay_as_you_go";
|
|
4
|
+
export type DainPaymentState = "draft" | "active" | "pending_cancellation" | "cancelled" | "expired" | "terminated" | "reviewed";
|
|
5
|
+
export type DainPaymentStatusFlag = keyof typeof SMART_ACCOUNT_PAYMENT_STATUS_BITS;
|
|
6
|
+
export type DainPaymentProgramType = keyof typeof SMART_ACCOUNT_PAYMENT_TYPE;
|
|
7
|
+
export interface DainPaymentProgramStatus {
|
|
8
|
+
mask: number;
|
|
9
|
+
flags?: DainPaymentStatusFlag[];
|
|
10
|
+
}
|
|
11
|
+
export interface DainPaymentMint {
|
|
12
|
+
chain: "solana";
|
|
13
|
+
mint: string;
|
|
14
|
+
decimals?: number;
|
|
15
|
+
symbol?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface DainPaymentOffer {
|
|
18
|
+
id: string;
|
|
19
|
+
kind: DainPaymentKind;
|
|
20
|
+
agent?: DainAgentRegistryRef;
|
|
21
|
+
organizationId?: number | string;
|
|
22
|
+
agentId?: number;
|
|
23
|
+
vaultId?: number;
|
|
24
|
+
mint: DainPaymentMint;
|
|
25
|
+
amount: string;
|
|
26
|
+
baseAmount?: string;
|
|
27
|
+
periodSeconds?: number;
|
|
28
|
+
trialSeconds?: number;
|
|
29
|
+
description?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface DainPaymentSubscription {
|
|
32
|
+
id: string;
|
|
33
|
+
state: DainPaymentState;
|
|
34
|
+
programStatus?: DainPaymentProgramStatus;
|
|
35
|
+
programType?: DainPaymentProgramType;
|
|
36
|
+
offerId?: string;
|
|
37
|
+
accountId: string;
|
|
38
|
+
smartAccountPDA: string;
|
|
39
|
+
agent?: DainAgentRegistryRef;
|
|
40
|
+
organizationId?: number | string;
|
|
41
|
+
agentId?: number;
|
|
42
|
+
vaultId?: number;
|
|
43
|
+
mint?: string;
|
|
44
|
+
paymentAccount?: string;
|
|
45
|
+
ephemeralKey?: string;
|
|
46
|
+
currentPeriodStart?: string;
|
|
47
|
+
currentPeriodEnd?: string;
|
|
48
|
+
remainingAmount?: string;
|
|
49
|
+
amount?: string;
|
|
50
|
+
baseAmount?: string;
|
|
51
|
+
baseAmountPaid?: string;
|
|
52
|
+
scheduledTerminationTime?: string;
|
|
53
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payments.js","sourceRoot":"","sources":["../../src/protocol/payments.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type DainDataAccessMode = "read" | "write";
|
|
2
|
+
export type DainDataSensitivity = "public" | "personal" | "financial" | "credential" | "secret";
|
|
3
|
+
export interface DainDataFieldRequirement {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
mode: DainDataAccessMode;
|
|
8
|
+
required?: boolean;
|
|
9
|
+
sensitivity?: DainDataSensitivity;
|
|
10
|
+
purpose?: string;
|
|
11
|
+
retention?: "none" | "session" | "automation" | "service";
|
|
12
|
+
}
|
|
13
|
+
export interface DainDataPermissionGrant {
|
|
14
|
+
id: string;
|
|
15
|
+
serviceId?: string;
|
|
16
|
+
agentId?: string;
|
|
17
|
+
accountId?: string;
|
|
18
|
+
fields: DainDataFieldRequirement[];
|
|
19
|
+
expiresAt?: string;
|
|
20
|
+
revokedAt?: string;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permissions.js","sourceRoot":"","sources":["../../src/protocol/permissions.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export declare const DAIN_PROGRAM_IDS: {
|
|
2
|
+
readonly registry: "4Phn622SNGS2oA9B2uJzDwFSMdKmBe1JzFeWB37b4XuQ";
|
|
3
|
+
readonly smartAccount: "21ZvHhaFLsTGkEWZmyyt7NrY8XQQJjArgCwwEgJ8NXdr";
|
|
4
|
+
};
|
|
5
|
+
export declare const DAIN_PROGRAM_SEEDS: {
|
|
6
|
+
readonly registry: "registry";
|
|
7
|
+
readonly organization: "organization";
|
|
8
|
+
readonly agent: "agent";
|
|
9
|
+
readonly smartAccount: "smart_account";
|
|
10
|
+
readonly vault: "vault";
|
|
11
|
+
readonly payments: "payments";
|
|
12
|
+
readonly passkey: "passkey";
|
|
13
|
+
};
|
|
14
|
+
export declare const SMART_ACCOUNT_MEMBER_PERMISSION_BITS: {
|
|
15
|
+
readonly initiate: number;
|
|
16
|
+
readonly vote: number;
|
|
17
|
+
readonly execute: number;
|
|
18
|
+
readonly review: number;
|
|
19
|
+
};
|
|
20
|
+
export declare const SMART_ACCOUNT_MEMBER_CATEGORY_BITS: {
|
|
21
|
+
readonly user: number;
|
|
22
|
+
readonly agent: number;
|
|
23
|
+
readonly organization: number;
|
|
24
|
+
readonly passkey: number;
|
|
25
|
+
readonly nft: number;
|
|
26
|
+
};
|
|
27
|
+
export declare const SMART_ACCOUNT_PAYMENT_STATUS_BITS: {
|
|
28
|
+
readonly active: number;
|
|
29
|
+
readonly cancelled: number;
|
|
30
|
+
readonly terminated: number;
|
|
31
|
+
readonly expired: number;
|
|
32
|
+
readonly reviewed: number;
|
|
33
|
+
readonly activated: number;
|
|
34
|
+
readonly pendingCancellation: number;
|
|
35
|
+
readonly baseClaimed: number;
|
|
36
|
+
};
|
|
37
|
+
export declare const SMART_ACCOUNT_PAYMENT_TYPE: {
|
|
38
|
+
readonly oneTime: 0;
|
|
39
|
+
readonly pureSubscription: 1;
|
|
40
|
+
readonly hybridSubscription: 2;
|
|
41
|
+
readonly payAsYouGo: 3;
|
|
42
|
+
};
|
|
43
|
+
export type SmartAccountProgramInstruction = "smart_account_create" | "proposal_activate" | "proposal_approve" | "proposal_reject" | "proposal_cancel" | "vault_transaction_create" | "vault_transaction_create_from_buffer" | "vault_transaction_execute" | "batch_create" | "batch_add_transaction" | "batch_execute_transaction" | "transaction_buffer_create" | "transaction_buffer_extend" | "transaction_buffer_close" | "internal_transaction_create" | "internal_transaction_execute" | "internal_spending_limit_usage" | "payments_transaction_create" | "payments_transaction_execute" | "payments_claim" | "payments_claim_rent" | "payments_submit_review" | "payments_terminate";
|
|
44
|
+
export type RegistryProgramInstruction = "registry_initialize" | "registry_update" | "registry_update_base_fees" | "registry_update_vip_levels_agent" | "registry_update_vip_levels_organization" | "registry_add_new_admin" | "registry_accept_new_admin" | "registry_remove_pending_new_admin" | "registry_lock" | "organization_reserve" | "organization_create" | "organization_update" | "organization_verify" | "organization_add_provider" | "organization_remove_provider" | "organization_freeze_agent" | "organization_defreeze_agent" | "organization_children_create" | "organization_child_update" | "organization_child_freeze" | "organization_child_defreeze" | "organization_claim_tokens" | "organization_children_claim_tokens" | "agent_reserve" | "agent_create" | "agent_update" | "agent_update_business_data" | "agent_verify" | "agent_add_payment_mint" | "agent_claim_tokens" | "reputation_create_agent" | "reputation_submit_review" | "reputation_claim_payment";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SMART_ACCOUNT_PAYMENT_TYPE = exports.SMART_ACCOUNT_PAYMENT_STATUS_BITS = exports.SMART_ACCOUNT_MEMBER_CATEGORY_BITS = exports.SMART_ACCOUNT_MEMBER_PERMISSION_BITS = exports.DAIN_PROGRAM_SEEDS = exports.DAIN_PROGRAM_IDS = void 0;
|
|
4
|
+
exports.DAIN_PROGRAM_IDS = {
|
|
5
|
+
registry: "4Phn622SNGS2oA9B2uJzDwFSMdKmBe1JzFeWB37b4XuQ",
|
|
6
|
+
smartAccount: "21ZvHhaFLsTGkEWZmyyt7NrY8XQQJjArgCwwEgJ8NXdr",
|
|
7
|
+
};
|
|
8
|
+
exports.DAIN_PROGRAM_SEEDS = {
|
|
9
|
+
registry: "registry",
|
|
10
|
+
organization: "organization",
|
|
11
|
+
agent: "agent",
|
|
12
|
+
smartAccount: "smart_account",
|
|
13
|
+
vault: "vault",
|
|
14
|
+
payments: "payments",
|
|
15
|
+
passkey: "passkey",
|
|
16
|
+
};
|
|
17
|
+
exports.SMART_ACCOUNT_MEMBER_PERMISSION_BITS = {
|
|
18
|
+
initiate: 1 << 0,
|
|
19
|
+
vote: 1 << 1,
|
|
20
|
+
execute: 1 << 2,
|
|
21
|
+
review: 1 << 3,
|
|
22
|
+
};
|
|
23
|
+
exports.SMART_ACCOUNT_MEMBER_CATEGORY_BITS = {
|
|
24
|
+
user: 1 << 0,
|
|
25
|
+
agent: 1 << 1,
|
|
26
|
+
organization: 1 << 2,
|
|
27
|
+
passkey: 1 << 3,
|
|
28
|
+
nft: 1 << 4,
|
|
29
|
+
};
|
|
30
|
+
exports.SMART_ACCOUNT_PAYMENT_STATUS_BITS = {
|
|
31
|
+
active: 1 << 0,
|
|
32
|
+
cancelled: 1 << 1,
|
|
33
|
+
terminated: 1 << 2,
|
|
34
|
+
expired: 1 << 3,
|
|
35
|
+
reviewed: 1 << 4,
|
|
36
|
+
activated: 1 << 5,
|
|
37
|
+
pendingCancellation: 1 << 6,
|
|
38
|
+
baseClaimed: 1 << 7,
|
|
39
|
+
};
|
|
40
|
+
exports.SMART_ACCOUNT_PAYMENT_TYPE = {
|
|
41
|
+
oneTime: 0,
|
|
42
|
+
pureSubscription: 1,
|
|
43
|
+
hybridSubscription: 2,
|
|
44
|
+
payAsYouGo: 3,
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=programs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":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
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { DainDataFieldRequirement } from "./permissions";
|
|
2
|
+
import type { DainPaymentOffer } from "./payments";
|
|
3
|
+
import type { DAIN_PROGRAM_IDS } from "./programs";
|
|
4
|
+
export type DainRegistryId = number | string;
|
|
5
|
+
export type DainRegistryProgramId = typeof DAIN_PROGRAM_IDS.registry;
|
|
6
|
+
export type DainSmartAccountProgramId = typeof DAIN_PROGRAM_IDS.smartAccount;
|
|
7
|
+
export interface DainRegistryRef {
|
|
8
|
+
programId: string;
|
|
9
|
+
network: "mainnet" | "devnet" | "testnet" | "localnet";
|
|
10
|
+
address: string;
|
|
11
|
+
}
|
|
12
|
+
export interface DainOrganizationRegistryRef {
|
|
13
|
+
id: DainRegistryId;
|
|
14
|
+
address: string;
|
|
15
|
+
name?: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
uri?: string;
|
|
18
|
+
verified?: boolean;
|
|
19
|
+
statusMask?: number;
|
|
20
|
+
reputationAddress?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface DainAgentRegistryRef {
|
|
23
|
+
organizationId: DainRegistryId;
|
|
24
|
+
agentId: number;
|
|
25
|
+
address: string;
|
|
26
|
+
name?: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
endpoint?: string;
|
|
29
|
+
verified?: boolean;
|
|
30
|
+
statusMask?: number;
|
|
31
|
+
signatories?: string[];
|
|
32
|
+
reputationAddress?: string;
|
|
33
|
+
organization?: DainOrganizationRegistryRef;
|
|
34
|
+
}
|
|
35
|
+
export interface DainServiceRegistryPolicy {
|
|
36
|
+
registry?: DainRegistryRef;
|
|
37
|
+
agent?: DainAgentRegistryRef;
|
|
38
|
+
requiredDataFields?: DainDataFieldRequirement[];
|
|
39
|
+
paymentOffers?: DainPaymentOffer[];
|
|
40
|
+
requiredScopes?: string[];
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/protocol/registry.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { DainAccountContext, DainAuthContext, DainGroupContext } from "./account";
|
|
2
|
+
import type { DainActionGrant } from "./grants";
|
|
3
|
+
import type { DainDataPermissionGrant } from "./permissions";
|
|
4
|
+
import type { DainServiceRegistryPolicy } from "./registry";
|
|
5
|
+
export interface DainRuntimeContext {
|
|
6
|
+
dainAccountId?: string;
|
|
7
|
+
dainGroupId?: string;
|
|
8
|
+
smartAccountPDA?: string;
|
|
9
|
+
account?: DainAccountContext;
|
|
10
|
+
group?: DainGroupContext;
|
|
11
|
+
auth?: DainAuthContext;
|
|
12
|
+
grants?: DainActionGrant[];
|
|
13
|
+
dataPermissions?: DainDataPermissionGrant[];
|
|
14
|
+
registryPolicy?: DainServiceRegistryPolicy;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/protocol/runtime.ts"],"names":[],"mappings":""}
|