@aephia/atlas-kit 0.6.0-next.8 → 0.6.0-next.9
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/identity/actions/create-profile.d.ts +54 -0
- package/dist/identity/actions/create-profile.d.ts.map +1 -0
- package/dist/identity/actions/create-profile.js +134 -0
- package/dist/identity/actions/create-profile.js.map +1 -0
- package/dist/identity/actions/index.d.ts +1 -0
- package/dist/identity/actions/index.d.ts.map +1 -1
- package/dist/identity/actions/index.js +1 -0
- package/dist/identity/actions/index.js.map +1 -1
- package/dist/internal/c4/profile-creation.d.ts +17 -0
- package/dist/internal/c4/profile-creation.d.ts.map +1 -0
- package/dist/internal/c4/profile-creation.js +36 -0
- package/dist/internal/c4/profile-creation.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type Address } from '@solana/kit';
|
|
2
|
+
import type { SageContext } from '../../client/contracts.js';
|
|
3
|
+
import { type Plan } from '../../planning/index.js';
|
|
4
|
+
/** One explicitly scoped key and its exact unsigned 64-bit permission mask.
|
|
5
|
+
* `expiresAt` is a nonnegative Unix timestamp in seconds; omission means no expiry.
|
|
6
|
+
* Profile AUTH keys must omit expiry and must be directly signing addresses.
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* declare const authority: Address;
|
|
10
|
+
* declare const playerProfileProgram: Address;
|
|
11
|
+
* const key: ProfileCreationKeyInput = {address: authority, scope: playerProfileProgram, permissionsRaw: 1n};
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export interface ProfileCreationKeyInput {
|
|
15
|
+
readonly address: Address;
|
|
16
|
+
readonly scope: Address;
|
|
17
|
+
readonly permissionsRaw: bigint;
|
|
18
|
+
readonly expiresAt?: bigint;
|
|
19
|
+
}
|
|
20
|
+
/** Explicit storage funder, ordered keys, and protected Profile update threshold.
|
|
21
|
+
* No permissions or threshold are selected automatically.
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* declare const funder: Address;
|
|
25
|
+
* declare const keys: readonly ProfileCreationKeyInput[];
|
|
26
|
+
* const options: PlanCreateProfileOptions = {funder, keys, keyThreshold: 1};
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export interface PlanCreateProfileOptions {
|
|
30
|
+
readonly funder: Address;
|
|
31
|
+
readonly keys: readonly ProfileCreationKeyInput[];
|
|
32
|
+
readonly keyThreshold: number;
|
|
33
|
+
}
|
|
34
|
+
/** Plans a new signer-created Profile with explicit scoped permissions.
|
|
35
|
+
* The new Profile, storage funder, and every Player Profile AUTH key sign creation,
|
|
36
|
+
* even when the editing threshold is lower. Other keys remain readonly.
|
|
37
|
+
* The threshold governs protected Profile updates; it is not a gameplay-wide multisig policy.
|
|
38
|
+
* Existing target accounts and a Profile address equal to its funder are rejected.
|
|
39
|
+
* No Game load, onboarding, funding top-up, key generation or signing is implicit.
|
|
40
|
+
* Storage rent, balances and final creation remain chain-authoritative. Simulate
|
|
41
|
+
* before requesting signatures; after confirmed execution, read `getProfile` and
|
|
42
|
+
* verify the exact keys, scopes, permission masks and threshold.
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* import {planCreateProfile} from '@aephia/atlas-kit/identity/actions';
|
|
46
|
+
* declare const ctx: SageContext;
|
|
47
|
+
* declare const profileAddress: Address;
|
|
48
|
+
* declare const options: PlanCreateProfileOptions;
|
|
49
|
+
* const plan = await planCreateProfile(ctx, profileAddress, options);
|
|
50
|
+
* console.log(plan.summary, plan.requiredSigners);
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export declare function planCreateProfile(ctx: SageContext, profileAddress: Address, input: PlanCreateProfileOptions): Promise<Plan>;
|
|
54
|
+
//# sourceMappingURL=create-profile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-profile.d.ts","sourceRoot":"","sources":["../../../src/identity/actions/create-profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAO7D,OAAO,EAAc,KAAK,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;;;;;;;;GASG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,SAAS,uBAAuB,EAAE,CAAC;IAClD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAkID;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,WAAW,EAChB,cAAc,EAAE,OAAO,EACvB,KAAK,EAAE,wBAAwB,GAC9B,OAAO,CAAC,IAAI,CAAC,CA0Cf"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { isAddress, isOffCurveAddress } from '@solana/kit';
|
|
2
|
+
import { InvalidActionInputError, SageSdkError } from '../../client/errors.js';
|
|
3
|
+
import { readContextRawAccounts } from '../../client/reconciliation.js';
|
|
4
|
+
import { createProfileInstruction, isProfileCreationAuthority, } from '../../internal/c4/profile-creation.js';
|
|
5
|
+
import { createPlan } from '../../planning/index.js';
|
|
6
|
+
function invalid(field, value, remedy) {
|
|
7
|
+
throw new InvalidActionInputError(field, value, 'explicit valid Profile creation input', remedy);
|
|
8
|
+
}
|
|
9
|
+
function record(value, field, allowed) {
|
|
10
|
+
if (value === null || typeof value !== 'object' || Array.isArray(value))
|
|
11
|
+
invalid(field, value, 'Pass an address-only options object for Profile creation.');
|
|
12
|
+
const result = value;
|
|
13
|
+
if (Object.keys(result).some((key) => !allowed.includes(key)))
|
|
14
|
+
invalid(field, value, 'Remove unrecognized fields and signer objects; specify only the documented Profile creation fields.');
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
17
|
+
function validAddress(value, field, signer) {
|
|
18
|
+
if (typeof value !== 'string' ||
|
|
19
|
+
!isAddress(value) ||
|
|
20
|
+
(signer && isOffCurveAddress(value)))
|
|
21
|
+
invalid(field, value, signer
|
|
22
|
+
? 'Supply the address of a directly signing external z.ink/Solana account.'
|
|
23
|
+
: 'Supply a valid z.ink/Solana account address.');
|
|
24
|
+
return value;
|
|
25
|
+
}
|
|
26
|
+
function options(input) {
|
|
27
|
+
const raw = record(input, 'options', ['funder', 'keys', 'keyThreshold']);
|
|
28
|
+
const funder = validAddress(raw.funder, 'options.funder', true);
|
|
29
|
+
if (!Array.isArray(raw.keys) || raw.keys.length === 0)
|
|
30
|
+
invalid('options.keys', raw.keys, 'Specify at least one non-expiring Player Profile AUTH key.');
|
|
31
|
+
const seen = new Set();
|
|
32
|
+
const keys = [];
|
|
33
|
+
for (const value of raw.keys) {
|
|
34
|
+
const key = record(value, 'options.keys[]', [
|
|
35
|
+
'address',
|
|
36
|
+
'scope',
|
|
37
|
+
'permissionsRaw',
|
|
38
|
+
'expiresAt',
|
|
39
|
+
]);
|
|
40
|
+
const address = validAddress(key.address, 'key.address', false);
|
|
41
|
+
const scope = validAddress(key.scope, 'key.scope', false);
|
|
42
|
+
const permissionsRaw = key.permissionsRaw;
|
|
43
|
+
if (typeof permissionsRaw !== 'bigint' ||
|
|
44
|
+
permissionsRaw < 0n ||
|
|
45
|
+
permissionsRaw > 0xffffffffffffffffn)
|
|
46
|
+
invalid('key.permissionsRaw', permissionsRaw, 'Supply an explicit bigint permission mask from 0n through 18446744073709551615n.');
|
|
47
|
+
const expiresAt = key.expiresAt;
|
|
48
|
+
if (expiresAt !== undefined &&
|
|
49
|
+
(typeof expiresAt !== 'bigint' ||
|
|
50
|
+
expiresAt < 0n ||
|
|
51
|
+
expiresAt > 0x7fffffffffffffffn))
|
|
52
|
+
invalid('key.expiresAt', expiresAt, 'Omit expiry for a permanent key, or supply nonnegative bigint Unix seconds within the signed 64-bit range.');
|
|
53
|
+
const captured = {
|
|
54
|
+
address,
|
|
55
|
+
scope,
|
|
56
|
+
permissionsRaw,
|
|
57
|
+
...(expiresAt === undefined ? {} : { expiresAt }),
|
|
58
|
+
};
|
|
59
|
+
if (isProfileCreationAuthority(captured)) {
|
|
60
|
+
validAddress(address, 'AUTH key.address', true);
|
|
61
|
+
if (expiresAt !== undefined)
|
|
62
|
+
invalid('AUTH key.expiresAt', expiresAt, 'Omit expiry for every Player Profile AUTH key.');
|
|
63
|
+
}
|
|
64
|
+
const identity = `${address}:${scope}`;
|
|
65
|
+
if (seen.has(identity))
|
|
66
|
+
invalid('options.keys', address, 'Remove duplicate address/scope pairs; distinct scopes may reuse one key address.');
|
|
67
|
+
seen.add(identity);
|
|
68
|
+
keys.push(captured);
|
|
69
|
+
}
|
|
70
|
+
const authCount = keys.filter(isProfileCreationAuthority).length;
|
|
71
|
+
const keyThreshold = raw.keyThreshold;
|
|
72
|
+
if (typeof keyThreshold !== 'number' ||
|
|
73
|
+
!Number.isInteger(keyThreshold) ||
|
|
74
|
+
keyThreshold < 1 ||
|
|
75
|
+
keyThreshold > 255 ||
|
|
76
|
+
keyThreshold > authCount)
|
|
77
|
+
invalid('options.keyThreshold', keyThreshold, 'Set an explicit integer threshold from 1 through the number of distinct Player Profile AUTH keys, no greater than 255.');
|
|
78
|
+
return { funder, keys, keyThreshold };
|
|
79
|
+
}
|
|
80
|
+
/** Plans a new signer-created Profile with explicit scoped permissions.
|
|
81
|
+
* The new Profile, storage funder, and every Player Profile AUTH key sign creation,
|
|
82
|
+
* even when the editing threshold is lower. Other keys remain readonly.
|
|
83
|
+
* The threshold governs protected Profile updates; it is not a gameplay-wide multisig policy.
|
|
84
|
+
* Existing target accounts and a Profile address equal to its funder are rejected.
|
|
85
|
+
* No Game load, onboarding, funding top-up, key generation or signing is implicit.
|
|
86
|
+
* Storage rent, balances and final creation remain chain-authoritative. Simulate
|
|
87
|
+
* before requesting signatures; after confirmed execution, read `getProfile` and
|
|
88
|
+
* verify the exact keys, scopes, permission masks and threshold.
|
|
89
|
+
* @example
|
|
90
|
+
* ```ts
|
|
91
|
+
* import {planCreateProfile} from '@aephia/atlas-kit/identity/actions';
|
|
92
|
+
* declare const ctx: SageContext;
|
|
93
|
+
* declare const profileAddress: Address;
|
|
94
|
+
* declare const options: PlanCreateProfileOptions;
|
|
95
|
+
* const plan = await planCreateProfile(ctx, profileAddress, options);
|
|
96
|
+
* console.log(plan.summary, plan.requiredSigners);
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
export async function planCreateProfile(ctx, profileAddress, input) {
|
|
100
|
+
const profile = validAddress(profileAddress, 'profileAddress', true);
|
|
101
|
+
// Capture every nested scalar before the first await; caller edits cannot change authority.
|
|
102
|
+
const captured = options(input);
|
|
103
|
+
if (profile === captured.funder)
|
|
104
|
+
invalid('profileAddress', profile, 'Use a fresh Profile signer address distinct from the storage funder; do not convert the funding wallet into a Profile.');
|
|
105
|
+
const [existing] = await readContextRawAccounts(ctx, [profile]);
|
|
106
|
+
if (existing)
|
|
107
|
+
throw new SageSdkError('ACTION_PRECONDITION_FAILED', `Profile target ${profile} already exists. Read an existing Profile with getProfile, or select a fresh signer address; creation is not idempotent.`, { address: profile });
|
|
108
|
+
const summary = `Create Profile ${profile} with ${captured.keys.length} explicitly scoped keys and protected Profile update threshold ${captured.keyThreshold}. ${captured.keys.map((key, index) => `Key ${index}: address ${key.address}, scope ${key.scope}, permissionsRaw ${key.permissionsRaw} (0x${key.permissionsRaw.toString(16)}), expiresAt ${key.expiresAt === undefined ? 'never' : key.expiresAt}, role ${isProfileCreationAuthority(key) ? 'Profile AUTH signer' : 'readonly key'}.`).join(' ')} Review these exact scoped permission masks; the threshold does not establish gameplay-wide multisig. Funder ${captured.funder} pays storage rent; transaction fees are separate. The Profile, funder and every Profile AUTH key sign creation. Rent, balances and final creation remain chain-authoritative: simulate before signing, then use getProfile after confirmed execution to verify keys, scopes, permissionsRaw and keyThreshold. No other onboarding or balance top-up is included.`;
|
|
109
|
+
return createPlan({
|
|
110
|
+
kind: 'identity.create-profile',
|
|
111
|
+
summary,
|
|
112
|
+
preconditions: [
|
|
113
|
+
{
|
|
114
|
+
kind: 'account-absent',
|
|
115
|
+
address: profile,
|
|
116
|
+
describes: `New Profile ${profile} remains absent; if another transaction creates it, read and inspect it before proceeding.`,
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
steps: [
|
|
120
|
+
{
|
|
121
|
+
describes: summary,
|
|
122
|
+
signers: [
|
|
123
|
+
captured.funder,
|
|
124
|
+
profile,
|
|
125
|
+
...captured.keys
|
|
126
|
+
.filter(isProfileCreationAuthority)
|
|
127
|
+
.map((key) => key.address),
|
|
128
|
+
],
|
|
129
|
+
instruction: createProfileInstruction({ profile, ...captured }),
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=create-profile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-profile.js","sourceRoot":"","sources":["../../../src/identity/actions/create-profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAgB,MAAM,aAAa,CAAC;AAEzE,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EACL,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAa,MAAM,yBAAyB,CAAC;AAkChE,SAAS,OAAO,CAAC,KAAa,EAAE,KAAc,EAA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AAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC;iBAC7B;gBACD,WAAW,EAAE,wBAAwB,CAAC,EAAE,OAAO,EAAE,GAAG,QAAQ,EAAE,CAAC;aAChE;SACF;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -34,4 +34,5 @@ export interface PlanRegisterCharacterOptions {
|
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
36
|
export declare function planRegisterCharacter(ctx: SageContext, profileAddress: Address, input: PlanRegisterCharacterOptions): Promise<Plan>;
|
|
37
|
+
export { planCreateProfile, type PlanCreateProfileOptions, type ProfileCreationKeyInput, } from './create-profile.js';
|
|
37
38
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/identity/actions/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAgC,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,KAAK,EAAc,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAUzE,OAAO,EAEL,KAAK,IAAI,EAEV,MAAM,yBAAyB,CAAC;AAGjC;;;;;;;GAOG;AACH,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AA2CD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,WAAW,EAChB,cAAc,EAAE,OAAO,EACvB,KAAK,EAAE,4BAA4B,GAClC,OAAO,CAAC,IAAI,CAAC,CA4Ef"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/identity/actions/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAgC,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,KAAK,EAAc,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAUzE,OAAO,EAEL,KAAK,IAAI,EAEV,MAAM,yBAAyB,CAAC;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,aAAa,EAAE;YACb,MAAM,OAAO,CACX,cAAc,EACd,WAAW,cAAc,8CAA8C,CACxE;YACD;gBACE,IAAI,EAAE,cAAc;gBACpB,OAAO,EAAE,WAAW,CAAC,OAAO;gBAC5B,SAAS,EAAE,QAAQ,IAAI,iHAAiH;aACzI;YACD;gBACE,IAAI,EAAE,gBAAgB;gBACtB,OAAO,EAAE,SAAS;gBAClB,SAAS,EAAE,uBAAuB,SAAS,kFAAkF;aAC9H;SACF;QACD,KAAK,EAAE;YACL;gBACE,SAAS,EAAE,OAAO;gBAClB,OAAO,EAAE,CAAC,MAAM,CAAC;gBACjB,WAAW,EAAE,kCAAkC,CAAC;oBAC9C,OAAO,EAAE,cAAc;oBACvB,MAAM;oBACN,SAAS;oBACT,IAAI;iBACL,CAAC;aACH;SACF;KACF,CAAC,CAAC;AACL,CAAC;AAED,OAAO,EACL,iBAAiB,GAGlB,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Address, type Instruction } from '@solana/kit';
|
|
2
|
+
export interface ProfileCreationKey {
|
|
3
|
+
readonly address: Address;
|
|
4
|
+
readonly scope: Address;
|
|
5
|
+
readonly permissionsRaw: bigint;
|
|
6
|
+
readonly expiresAt?: bigint;
|
|
7
|
+
}
|
|
8
|
+
/** AUTH belongs to the Player Profile scope, not to gameplay permission bit zero. */
|
|
9
|
+
export declare function isProfileCreationAuthority(key: ProfileCreationKey): boolean;
|
|
10
|
+
/** Encode audited remaining-account roles without constructing signer objects. */
|
|
11
|
+
export declare function createProfileInstruction(input: {
|
|
12
|
+
readonly profile: Address;
|
|
13
|
+
readonly funder: Address;
|
|
14
|
+
readonly keys: readonly ProfileCreationKey[];
|
|
15
|
+
readonly keyThreshold: number;
|
|
16
|
+
}): Instruction;
|
|
17
|
+
//# sourceMappingURL=profile-creation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-creation.d.ts","sourceRoot":"","sources":["../../../src/internal/c4/profile-creation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAM1E,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,qFAAqF;AACrF,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,kBAAkB,GAAG,OAAO,CAK3E;AAED,kFAAkF;AAClF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE;IAC9C,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,SAAS,kBAAkB,EAAE,CAAC;IAC7C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B,GAAG,WAAW,CA4Bd"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AccountRole } from '@solana/kit';
|
|
2
|
+
import { PLAYER_PROFILE_PROGRAM_ADDRESS, getCreateProfileInstructionDataEncoder, } from '@staratlas/dev-player-profile';
|
|
3
|
+
/** AUTH belongs to the Player Profile scope, not to gameplay permission bit zero. */
|
|
4
|
+
export function isProfileCreationAuthority(key) {
|
|
5
|
+
return (key.scope === PLAYER_PROFILE_PROGRAM_ADDRESS &&
|
|
6
|
+
(key.permissionsRaw & 1n) !== 0n);
|
|
7
|
+
}
|
|
8
|
+
/** Encode audited remaining-account roles without constructing signer objects. */
|
|
9
|
+
export function createProfileInstruction(input) {
|
|
10
|
+
return {
|
|
11
|
+
programAddress: PLAYER_PROFILE_PROGRAM_ADDRESS,
|
|
12
|
+
accounts: [
|
|
13
|
+
{ address: input.funder, role: AccountRole.WRITABLE_SIGNER },
|
|
14
|
+
{ address: input.profile, role: AccountRole.WRITABLE_SIGNER },
|
|
15
|
+
{
|
|
16
|
+
address: '11111111111111111111111111111111',
|
|
17
|
+
role: AccountRole.READONLY,
|
|
18
|
+
},
|
|
19
|
+
...input.keys.map((key) => ({
|
|
20
|
+
address: key.address,
|
|
21
|
+
role: isProfileCreationAuthority(key)
|
|
22
|
+
? AccountRole.READONLY_SIGNER
|
|
23
|
+
: AccountRole.READONLY,
|
|
24
|
+
})),
|
|
25
|
+
],
|
|
26
|
+
data: getCreateProfileInstructionDataEncoder().encode({
|
|
27
|
+
keyThreshold: input.keyThreshold,
|
|
28
|
+
keyPermissions: input.keys.map((key) => ({
|
|
29
|
+
scope: key.scope,
|
|
30
|
+
expireTime: key.expiresAt ?? -1n,
|
|
31
|
+
permissions: Array.from({ length: 8 }, (_, index) => Number((key.permissionsRaw >> BigInt(index * 8)) & 255n)),
|
|
32
|
+
})),
|
|
33
|
+
}),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=profile-creation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-creation.js","sourceRoot":"","sources":["../../../src/internal/c4/profile-creation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkC,MAAM,aAAa,CAAC;AAC1E,OAAO,EACL,8BAA8B,EAC9B,sCAAsC,GACvC,MAAM,+BAA+B,CAAC;AASvC,qFAAqF;AACrF,MAAM,UAAU,0BAA0B,CAAC,GAAuB;IAChE,OAAO,CACL,GAAG,CAAC,KAAK,KAAK,8BAA8B;QAC5C,CAAC,GAAG,CAAC,cAAc,GAAG,EAAE,CAAC,KAAK,EAAE,CACjC,CAAC;AACJ,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,wBAAwB,CAAC,KAKxC;IACC,OAAO;QACL,cAAc,EAAE,8BAA8B;QAC9C,QAAQ,EAAE;YACR,EAAE,OAAO,EAAE,KAAK,CAAC,MAAM,EAAE,IA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