defender-admin-client
Advanced tools
Comparing version 1.31.0-rc.2 to 1.31.0-rc.3
@@ -38,3 +38,7 @@ import { BaseApiClient } from 'defender-base-client'; | ||
createProposal(proposal: CreateProposalRequest): Promise<ProposalResponseWithUrl>; | ||
listProposals(): Promise<ProposalResponseWithUrl[]>; | ||
listProposals(opts?: { | ||
includeArchived?: boolean; | ||
}): Promise<ProposalResponseWithUrl[]>; | ||
archiveProposal(contractId: string, proposalId: string): Promise<ProposalResponseWithUrl>; | ||
unarchiveProposal(contractId: string, proposalId: string): Promise<ProposalResponseWithUrl>; | ||
proposeUpgrade(params: UpgradeParams, contract: CreateProposalRequest['contract']): Promise<ProposalResponseWithUrl>; | ||
@@ -41,0 +45,0 @@ proposePause(params: PauseParams, contract: CreateProposalRequest['contract']): Promise<ProposalResponseWithUrl>; |
@@ -38,8 +38,24 @@ "use strict"; | ||
} | ||
async listProposals() { | ||
async listProposals(opts = {}) { | ||
return this.apiCall(async (api) => { | ||
const response = (await api.get('/proposals')); | ||
const response = (await api.get('/proposals', { params: opts })); | ||
return response.map((proposal) => ({ ...proposal, url: utils_1.getProposalUrl(proposal) })); | ||
}); | ||
} | ||
async archiveProposal(contractId, proposalId) { | ||
return this.apiCall(async (api) => { | ||
const response = (await api.put(`/contracts/${contractId}/proposals/${proposalId}/archived`, { | ||
archived: true, | ||
})); | ||
return { ...response, url: utils_1.getProposalUrl(response) }; | ||
}); | ||
} | ||
async unarchiveProposal(contractId, proposalId) { | ||
return this.apiCall(async (api) => { | ||
const response = (await api.put(`/contracts/${contractId}/proposals/${proposalId}/archived`, { | ||
archived: false, | ||
})); | ||
return { ...response, url: utils_1.getProposalUrl(response) }; | ||
}); | ||
} | ||
async proposeUpgrade(params, contract) { | ||
@@ -46,0 +62,0 @@ var _a, _b; |
@@ -7,3 +7,4 @@ import { ExternalApiCreateProposalRequest } from './proposal'; | ||
isActive: boolean; | ||
isArchived: boolean; | ||
} | ||
//# sourceMappingURL=response.d.ts.map |
{ | ||
"name": "defender-admin-client", | ||
"version": "1.31.0-rc.2", | ||
"version": "1.31.0-rc.3", | ||
"description": "", | ||
@@ -29,3 +29,3 @@ "main": "./lib/index.js", | ||
}, | ||
"gitHead": "e244687a0b14906e390075ac62e670226b837405" | ||
"gitHead": "05e49c07cfdec351d68150ad02196a5cdc7158ea" | ||
} |
@@ -113,4 +113,13 @@ # Defender Admin Client | ||
You can filter your active proposals by `isActive` property present on each proposal in the list response. | ||
You can filter your active proposals by `isActive` property present on each proposal in the list response. By default, only unarchived proposals are returned, but you can override this by adding an `includeArchived: true` option in the call. | ||
### Archiving proposals | ||
You can archive or unarchive a proposal given its contract and proposal ids: | ||
```js | ||
await client.archiveProposal(contractId, proposalId); | ||
await client.unarchiveProposal(contractId, proposalId); | ||
``` | ||
## Adding Contracts | ||
@@ -117,0 +126,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
118361
321
157