Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yurushao committed Aug 18, 2024
1 parent 1d5bc69 commit c998670
Show file tree
Hide file tree
Showing 5 changed files with 256 additions and 132 deletions.
11 changes: 6 additions & 5 deletions anchor/src/client/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ export class BaseClient {
fund: any
): Promise<[TransactionSignature, PublicKey]> {
let fundModel = this.enrichFundModelInitialize(fund);

const fundPDA = this.getFundPDA(fundModel);
const treasury = this.getTreasuryPDA(fundPDA);
const openfunds = this.getOpenfundsPDA(fundPDA);
Expand Down Expand Up @@ -584,12 +585,12 @@ export class BaseClient {
return fund;
}

public async deleteAcls(
public async deleteDelegateAcls(
fundPDA: PublicKey,
keys: PublicKey[]
): Promise<TransactionSignature> {
let updatedFund = this.getFundModel({
acls: keys.map((key) => ({ pubkey: key, permissions: [] })),
delegateAcls: keys.map((key) => ({ pubkey: key, permissions: [] })),
});
return await this.program.methods
.updateFund(updatedFund)
Expand All @@ -600,11 +601,11 @@ export class BaseClient {
.rpc();
}

public async upsertAcls(
public async upsertDelegateAcls(
fundPDA: PublicKey,
acls: any[]
delegateAcls: any[]
): Promise<TransactionSignature> {
let updatedFund = this.getFundModel({ acls });
let updatedFund = this.getFundModel({ delegateAcls });
return await this.program.methods
.updateFund(updatedFund)
.accounts({
Expand Down
4 changes: 2 additions & 2 deletions anchor/src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export const FundModel = class<FundModel> {
...partial,
assets: obj.assets || [],
assetsWeights: obj.assetsWeights || [],
acls: obj.acls || [],
integrations: obj.integrations || [],
delegateAcls: obj.delegateAcls || [],
integrationAcls: obj.integrationAcls || [],
shareClasses: obj.shareClasses
? obj.shareClasses.map(
(shareClass: any) =>
Expand Down
99 changes: 69 additions & 30 deletions anchor/target/idl/glam.json
Original file line number Diff line number Diff line change
Expand Up @@ -1761,7 +1761,7 @@
}
},
{
"name": "Acl",
"name": "DelegateAcl",
"type": {
"kind": "struct",
"fields": [
Expand All @@ -1780,6 +1780,28 @@
]
}
},
{
"name": "IntegrationAcl",
"type": {
"kind": "struct",
"fields": [
{
"name": "name",
"type": {
"defined": "IntegrationName"
}
},
{
"name": "features",
"type": {
"vec": {
"defined": "IntegrationFeature"
}
}
}
]
}
},
{
"name": "FundModel",
"type": {
Expand Down Expand Up @@ -1860,18 +1882,18 @@
}
},
{
"name": "acls",
"name": "delegateAcls",
"type": {
"vec": {
"defined": "Acl"
"defined": "DelegateAcl"
}
}
},
{
"name": "integrations",
"name": "integrationAcls",
"type": {
"vec": {
"defined": "Integration"
"defined": "IntegrationAcl"
}
}
},
Expand Down Expand Up @@ -2490,10 +2512,10 @@
"name": "ShareClassBlocklist"
},
{
"name": "Acls"
"name": "DelegateAcls"
},
{
"name": "Integrations"
"name": "IntegrationAcls"
}
]
}
Expand Down Expand Up @@ -2634,26 +2656,26 @@
]
},
{
"name": "VecAcl",
"name": "VecDelegateAcl",
"fields": [
{
"name": "val",
"type": {
"vec": {
"defined": "Acl"
"defined": "DelegateAcl"
}
}
}
]
},
{
"name": "VecIntegrations",
"name": "VecIntegrationAcl",
"fields": [
{
"name": "val",
"type": {
"vec": {
"defined": "Integration"
"defined": "IntegrationAcl"
}
}
}
Expand All @@ -2675,6 +2697,9 @@
},
{
"name": "Permission",
"docs": [
"* Delegate ACL"
],
"type": {
"kind": "enum",
"variants": [
Expand Down Expand Up @@ -2709,58 +2734,72 @@
}
},
{
"name": "Action",
"name": "IntegrationName",
"docs": [
"* Integration ACL"
],
"type": {
"kind": "enum",
"variants": [
{
"name": "Subscribe"
"name": "Drift"
},
{
"name": "Redeem"
"name": "StakePool"
},
{
"name": "NativeStaking"
},
{
"name": "Marinade"
},
{
"name": "Jupiter"
}
]
}
},
{
"name": "PriceDenom",
"name": "IntegrationFeature",
"type": {
"kind": "enum",
"variants": [
{
"name": "Asset"
},
{
"name": "SOL"
},
"name": "All"
}
]
}
},
{
"name": "Action",
"type": {
"kind": "enum",
"variants": [
{
"name": "USD"
"name": "Subscribe"
},
{
"name": "EUR"
"name": "Redeem"
}
]
}
},
{
"name": "Integration",
"name": "PriceDenom",
"type": {
"kind": "enum",
"variants": [
{
"name": "Drift"
},
{
"name": "StakePool"
"name": "Asset"
},
{
"name": "NativeStaking"
"name": "SOL"
},
{
"name": "Marinade"
"name": "USD"
},
{
"name": "Jupiter"
"name": "EUR"
}
]
}
Expand Down
Loading

0 comments on commit c998670

Please sign in to comment.