@zebec-network/solana-payroll-sdk 2.3.0 → 2.3.1
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/README.md +0 -0
- package/dist/instructions.d.ts +0 -13
- package/dist/instructions.js +0 -15
- package/dist/services.d.ts +1 -2
- package/dist/services.js +1 -35
- package/dist/types.d.ts +0 -6
- package/package.json +46 -46
package/README.md
CHANGED
|
Binary file
|
package/dist/instructions.d.ts
CHANGED
|
@@ -112,19 +112,6 @@ export declare function createYieldDepositInstruction(program: Program<ZebecPayr
|
|
|
112
112
|
nonce: BN;
|
|
113
113
|
companyId: number[];
|
|
114
114
|
}): Promise<TransactionInstruction>;
|
|
115
|
-
export declare function createUnlockNowInstruction(program: Program<ZebecPayrollIdl>, accounts: {
|
|
116
|
-
feePayer: PublicKey;
|
|
117
|
-
company: PublicKey;
|
|
118
|
-
companyDeposit: PublicKey;
|
|
119
|
-
yieldConfig: PublicKey;
|
|
120
|
-
admin: PublicKey;
|
|
121
|
-
centralVaultTokenAta: PublicKey;
|
|
122
|
-
companyTokenAta: PublicKey;
|
|
123
|
-
depositMint: PublicKey;
|
|
124
|
-
}, data: {
|
|
125
|
-
nonce: BN;
|
|
126
|
-
companyId: number[];
|
|
127
|
-
}): Promise<TransactionInstruction>;
|
|
128
115
|
export declare function createRequestUnlockInstruction(program: Program<ZebecPayrollIdl>, accounts: {
|
|
129
116
|
company: PublicKey;
|
|
130
117
|
companyDeposit: PublicKey;
|
package/dist/instructions.js
CHANGED
|
@@ -146,21 +146,6 @@ export async function createYieldDepositInstruction(program, accounts, data) {
|
|
|
146
146
|
})
|
|
147
147
|
.instruction();
|
|
148
148
|
}
|
|
149
|
-
export async function createUnlockNowInstruction(program, accounts, data) {
|
|
150
|
-
return program.methods
|
|
151
|
-
.unlockNow(data.companyId, data.nonce)
|
|
152
|
-
.accountsPartial({
|
|
153
|
-
feePayer: accounts.feePayer,
|
|
154
|
-
company: accounts.company,
|
|
155
|
-
companyDeposit: accounts.companyDeposit,
|
|
156
|
-
yieldConfig: accounts.yieldConfig,
|
|
157
|
-
admin: accounts.admin,
|
|
158
|
-
centralVaultTokenAta: accounts.centralVaultTokenAta,
|
|
159
|
-
companyTokenAta: accounts.companyTokenAta,
|
|
160
|
-
depositMint: accounts.depositMint,
|
|
161
|
-
})
|
|
162
|
-
.instruction();
|
|
163
|
-
}
|
|
164
149
|
export async function createRequestUnlockInstruction(program, accounts, data) {
|
|
165
150
|
return program.methods
|
|
166
151
|
.requestUnlock(data.companyId, data.nonce)
|
package/dist/services.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { type Commitment } from "@solana/web3.js";
|
|
|
3
3
|
import { MultiTransactionPayload, TransactionPayload } from "@zebec-network/solana-common";
|
|
4
4
|
import type { ZebecConfigs as ZebecConfigsIdl } from "@zebec-network/zebec_configs";
|
|
5
5
|
import type { ZebecPayroll as ZebecPayrollIdl } from "@zebec-network/zebec_payroll";
|
|
6
|
-
import type { CancelMultiplePayrollParams, CancelPayrollParams, CancelUnlockParams, ChangePayrollReceiverParams, CompanyDepositInfo, CompanyNonceInfo, CompleteUnlockParams, CreateMultiplePayrollParams, CreatePayrollParams, DistributeRewardsParams, PauseResumeMultiplePayrollParams, PauseResumePayrollParams, PayrollConfigInfo, PayrollMetadataInfo, RequestUnlockParams, SetMultipleTopupDelegateParams, SetTopupDelegateParams, TokenMetadata, TopupMultiplePayrollParams, TopupPayrollParams,
|
|
6
|
+
import type { CancelMultiplePayrollParams, CancelPayrollParams, CancelUnlockParams, ChangePayrollReceiverParams, CompanyDepositInfo, CompanyNonceInfo, CompleteUnlockParams, CreateMultiplePayrollParams, CreatePayrollParams, DistributeRewardsParams, PauseResumeMultiplePayrollParams, PauseResumePayrollParams, PayrollConfigInfo, PayrollMetadataInfo, RequestUnlockParams, SetMultipleTopupDelegateParams, SetTopupDelegateParams, TokenMetadata, TopupMultiplePayrollParams, TopupPayrollParams, WithdrawMultiplePayrollParams, WithdrawPayrollParams, YieldDepositParams } from "./types.js";
|
|
7
7
|
export declare function getPayrollConfig(configProgram: Program<ZebecConfigsIdl>, configName: string): Promise<PayrollConfigInfo>;
|
|
8
8
|
export declare function getWhitelistedTokens(configProgram: Program<ZebecConfigsIdl>, configName: string, commitment?: "processed" | "confirmed" | "finalized"): Promise<TokenMetadata[]>;
|
|
9
9
|
export declare function getPayrollMetadataInfo(program: Program<ZebecPayrollIdl>, payrollMetadata: Address, commitment?: Commitment): Promise<PayrollMetadataInfo>;
|
|
@@ -22,7 +22,6 @@ export declare function topupPayroll(payrollProgram: Program<ZebecPayrollIdl>, c
|
|
|
22
22
|
export declare function topupMultiplePayroll(payrollProgram: Program<ZebecPayrollIdl>, configProgram: Program<ZebecConfigsIdl>, params: TopupMultiplePayrollParams): Promise<MultiTransactionPayload>;
|
|
23
23
|
export declare function getCompanyNonceInfo(payrollProgram: Program<ZebecPayrollIdl>, companyIdBuffer: Buffer, commitment?: Commitment): Promise<CompanyNonceInfo | null>;
|
|
24
24
|
export declare function yieldDeposit(payrollProgram: Program<ZebecPayrollIdl>, configsProgram: Program<ZebecConfigsIdl>, params: YieldDepositParams, commitment?: Commitment): Promise<TransactionPayload>;
|
|
25
|
-
export declare function unlockNow(payrollProgram: Program<ZebecPayrollIdl>, configsProgram: Program<ZebecConfigsIdl>, params: UnlockNowParams, commitment?: Commitment): Promise<TransactionPayload>;
|
|
26
25
|
export declare function requestUnlock(payrollProgram: Program<ZebecPayrollIdl>, configsProgram: Program<ZebecConfigsIdl>, params: RequestUnlockParams): Promise<TransactionPayload>;
|
|
27
26
|
export declare function cancelUnlock(payrollProgram: Program<ZebecPayrollIdl>, params: CancelUnlockParams): Promise<TransactionPayload>;
|
|
28
27
|
export declare function completeUnlock(payrollProgram: Program<ZebecPayrollIdl>, configsProgram: Program<ZebecConfigsIdl>, params: CompleteUnlockParams, commitment?: Commitment): Promise<TransactionPayload>;
|
package/dist/services.js
CHANGED
|
@@ -8,7 +8,7 @@ import { createAssociatedTokenAccountInstruction, getAssociatedTokenAddressSync,
|
|
|
8
8
|
import { BigNumber } from "bignumber.js";
|
|
9
9
|
import { BN } from "bn.js";
|
|
10
10
|
import { PAYROLL_NAME_BUFFER_SIZE, USX_DECIMALS } from "./constants.js";
|
|
11
|
-
import { createCancelPayrollInstruction, createCancelUnlockInstruction, createChangeRecipientInstruction, createCompleteUnlockInstruction, createCreatePayrollInstruction, createDistributeRewardsInstruction, createPauseResumePayrollInstruction, createRequestUnlockInstruction, createSetTopupDelegateInstruction, createTopupPayrollInstruction, createTransferFeesInstruction,
|
|
11
|
+
import { createCancelPayrollInstruction, createCancelUnlockInstruction, createChangeRecipientInstruction, createCompleteUnlockInstruction, createCreatePayrollInstruction, createDistributeRewardsInstruction, createPauseResumePayrollInstruction, createRequestUnlockInstruction, createSetTopupDelegateInstruction, createTopupPayrollInstruction, createTransferFeesInstruction, createWithdrawPayrollInstruction, createYieldDepositInstruction, } from "./instructions.js";
|
|
12
12
|
import { deriveCompanyDepositPda, deriveCompanyNoncePda, derivePayrollConfigPda, derivePayrollVaultPda, deriveYieldConfigPda, } from "./pda.js";
|
|
13
13
|
import { getFeeInfoForPayroll } from "./utils.js";
|
|
14
14
|
export async function getPayrollConfig(configProgram, configName) {
|
|
@@ -734,40 +734,6 @@ export async function yieldDeposit(payrollProgram, configsProgram, params, commi
|
|
|
734
734
|
});
|
|
735
735
|
return createTransactionPayload(payrollProgram, company, [ix]);
|
|
736
736
|
}
|
|
737
|
-
export async function unlockNow(payrollProgram, configsProgram, params, commitment) {
|
|
738
|
-
commitment = commitment ?? payrollProgram.provider.connection.commitment;
|
|
739
|
-
const company = translateAddress(params.company);
|
|
740
|
-
const feePayer = translateAddress(params.feePayer);
|
|
741
|
-
const [yieldConfig] = deriveYieldConfigPda(configsProgram.programId);
|
|
742
|
-
const configData = await configsProgram.account.yieldConfig.fetchNullable(yieldConfig, commitment);
|
|
743
|
-
if (!configData) {
|
|
744
|
-
throw new Error("YieldConfigNotFound: Yield config is not initialized in Zebec Configs Program");
|
|
745
|
-
}
|
|
746
|
-
// central vault is also the admin
|
|
747
|
-
const admin = configData.centralVault;
|
|
748
|
-
const [companyDeposit] = deriveCompanyDepositPda(Buffer.from(params.companyId), params.nonce, payrollProgram.programId);
|
|
749
|
-
const companyDepositData = await payrollProgram.account.companyDeposit.fetchNullable(companyDeposit, commitment);
|
|
750
|
-
if (!companyDepositData) {
|
|
751
|
-
throw new Error(`CompanyDepositNotFound: Company Deposit does not exists for nonce: ${params.nonce.toString()}n and companyId: [${Array.from(params.companyId).toString()}]`);
|
|
752
|
-
}
|
|
753
|
-
const depositMint = companyDepositData.depositMint;
|
|
754
|
-
const adminTokenAta = getAssociatedTokenAddressSync(depositMint, admin, true);
|
|
755
|
-
const companyTokenAta = getAssociatedTokenAddressSync(depositMint, company, true);
|
|
756
|
-
const ix = await createUnlockNowInstruction(payrollProgram, {
|
|
757
|
-
feePayer,
|
|
758
|
-
company,
|
|
759
|
-
companyDeposit,
|
|
760
|
-
yieldConfig,
|
|
761
|
-
admin,
|
|
762
|
-
centralVaultTokenAta: adminTokenAta,
|
|
763
|
-
companyTokenAta,
|
|
764
|
-
depositMint,
|
|
765
|
-
}, {
|
|
766
|
-
companyId: Array.from(params.companyId),
|
|
767
|
-
nonce: new BN(params.nonce),
|
|
768
|
-
});
|
|
769
|
-
return createTransactionPayload(payrollProgram, feePayer, [ix]);
|
|
770
|
-
}
|
|
771
737
|
export async function requestUnlock(payrollProgram, configsProgram, params) {
|
|
772
738
|
const company = translateAddress(params.company);
|
|
773
739
|
const feePayer = translateAddress(params.feePayer);
|
package/dist/types.d.ts
CHANGED
|
@@ -205,12 +205,6 @@ export type YieldDepositParams = {
|
|
|
205
205
|
depoistMint: Address;
|
|
206
206
|
amount: Numeric;
|
|
207
207
|
};
|
|
208
|
-
export type UnlockNowParams = {
|
|
209
|
-
feePayer: Address;
|
|
210
|
-
company: Address;
|
|
211
|
-
nonce: bigint;
|
|
212
|
-
companyId: Buffer | Uint8Array;
|
|
213
|
-
};
|
|
214
208
|
export type RequestUnlockParams = {
|
|
215
209
|
feePayer: Address;
|
|
216
210
|
company: Address;
|
package/package.json
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
{
|
|
2
|
-
"author": "Zebec Network",
|
|
3
|
-
"dependencies": {
|
|
4
|
-
"@coral-xyz/anchor": "^0.31.1",
|
|
5
|
-
"@metaplex-foundation/mpl-token-metadata": "^3.4.0",
|
|
6
|
-
"@metaplex-foundation/umi": "^1.5.1",
|
|
7
|
-
"@metaplex-foundation/umi-bundle-defaults": "^1.5.1",
|
|
8
|
-
"@metaplex-foundation/umi-web3js-adapters": "^1.5.1",
|
|
9
|
-
"@solana/spl-token": "^0.4.14",
|
|
10
|
-
"@solana/web3.js": "^1.98.2",
|
|
11
|
-
"@zebec-network/core-utils": "^1.
|
|
12
|
-
"@zebec-network/solana-common": "^2.6.0",
|
|
13
|
-
"@zebec-network/zebec_configs": "^1.2.2",
|
|
14
|
-
"@zebec-network/zebec_payroll": "^1.4.
|
|
15
|
-
"bignumber.js": "^11.
|
|
16
|
-
},
|
|
17
|
-
"devDependencies": {
|
|
18
|
-
"@types/bn.js": "^5.2.0",
|
|
19
|
-
"@types/mocha": "^10.0.10",
|
|
20
|
-
"@types/node": "^25.6.0",
|
|
21
|
-
"dotenv": "^17.4.2",
|
|
22
|
-
"mocha": "^11.7.5",
|
|
23
|
-
"rimraf": "^6.1.3",
|
|
24
|
-
"ts-mocha": "^11.1.0",
|
|
25
|
-
"ts-node": "^10.9.2",
|
|
26
|
-
"typescript": "^6.0.3"
|
|
27
|
-
},
|
|
28
|
-
"files": [
|
|
29
|
-
"dist"
|
|
30
|
-
],
|
|
31
|
-
"license": "MIT",
|
|
32
|
-
"main": "dist/index.js",
|
|
33
|
-
"name": "@zebec-network/solana-payroll-sdk",
|
|
34
|
-
"private": false,
|
|
35
|
-
"scripts": {
|
|
36
|
-
"build": "npm run clean && tsc",
|
|
37
|
-
"clean": "rimraf ./dist",
|
|
38
|
-
"format": "npx @biomejs/biome format --write",
|
|
39
|
-
"prepare": "npm run build",
|
|
40
|
-
"run:example": "node --loader ts-node/esm -- example/buildTransactionAndSendForSigning.ts",
|
|
41
|
-
"test": "ts-mocha -p ./tsconfig.json -t 1000000000 test/**/*.test.ts",
|
|
42
|
-
"test:single": "ts-mocha -p ./tsconfig.json -t 1000000000 --"
|
|
43
|
-
},
|
|
44
|
-
"type": "module",
|
|
45
|
-
"types": "dist/index.d.ts",
|
|
46
|
-
"version": "2.3.
|
|
1
|
+
{
|
|
2
|
+
"author": "Zebec Network",
|
|
3
|
+
"dependencies": {
|
|
4
|
+
"@coral-xyz/anchor": "^0.31.1",
|
|
5
|
+
"@metaplex-foundation/mpl-token-metadata": "^3.4.0",
|
|
6
|
+
"@metaplex-foundation/umi": "^1.5.1",
|
|
7
|
+
"@metaplex-foundation/umi-bundle-defaults": "^1.5.1",
|
|
8
|
+
"@metaplex-foundation/umi-web3js-adapters": "^1.5.1",
|
|
9
|
+
"@solana/spl-token": "^0.4.14",
|
|
10
|
+
"@solana/web3.js": "^1.98.2",
|
|
11
|
+
"@zebec-network/core-utils": "^1.3.0",
|
|
12
|
+
"@zebec-network/solana-common": "^2.6.0",
|
|
13
|
+
"@zebec-network/zebec_configs": "^1.2.2",
|
|
14
|
+
"@zebec-network/zebec_payroll": "^1.4.5",
|
|
15
|
+
"bignumber.js": "^11.1.1"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/bn.js": "^5.2.0",
|
|
19
|
+
"@types/mocha": "^10.0.10",
|
|
20
|
+
"@types/node": "^25.6.0",
|
|
21
|
+
"dotenv": "^17.4.2",
|
|
22
|
+
"mocha": "^11.7.5",
|
|
23
|
+
"rimraf": "^6.1.3",
|
|
24
|
+
"ts-mocha": "^11.1.0",
|
|
25
|
+
"ts-node": "^10.9.2",
|
|
26
|
+
"typescript": "^6.0.3"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist"
|
|
30
|
+
],
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"main": "dist/index.js",
|
|
33
|
+
"name": "@zebec-network/solana-payroll-sdk",
|
|
34
|
+
"private": false,
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "npm run clean && tsc",
|
|
37
|
+
"clean": "rimraf ./dist",
|
|
38
|
+
"format": "npx @biomejs/biome format --write",
|
|
39
|
+
"prepare": "npm run build",
|
|
40
|
+
"run:example": "node --loader ts-node/esm -- example/buildTransactionAndSendForSigning.ts",
|
|
41
|
+
"test": "ts-mocha -p ./tsconfig.json -t 1000000000 test/**/*.test.ts",
|
|
42
|
+
"test:single": "ts-mocha -p ./tsconfig.json -t 1000000000 --"
|
|
43
|
+
},
|
|
44
|
+
"type": "module",
|
|
45
|
+
"types": "dist/index.d.ts",
|
|
46
|
+
"version": "2.3.1"
|
|
47
47
|
}
|