Skip to content

Commit

Permalink
upgrade platform-sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
shahnami committed Jul 30, 2023
2 parents 8b2cd36 + 07740af commit c986d35
Show file tree
Hide file tree
Showing 18 changed files with 88 additions and 71 deletions.
2 changes: 1 addition & 1 deletion examples/platform-test-project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
],
"license": "MIT",
"devDependencies": {
"@openzeppelin/platform-as-code": "^1.3.1",
"@openzeppelin/platform-as-code": "^1.3.2",
"serverless": "^3.20.0"
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"typescript": "^4.9.5"
},
"dependencies": {
"@openzeppelin/platform-sdk": "^0.1.0",
"@openzeppelin/platform-sdk": "^0.2.0",
"keccak256": "^1.0.6",
"lodash": "^4.17.21",
"prompt": "^1.3.0"
Expand Down
18 changes: 9 additions & 9 deletions src/cmd/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export default class PlatformDeploy {
const formattedResources = {
actions:
withResources.actions.length > 0
? withResources.actions.map((a) => `${a.stackResourceId ?? a.name} (${a.actionkId})`)
? withResources.actions.map((a) => `${a.stackResourceId ?? a.name} (${a.actionId})`)
: undefined,
monitors:
withResources.monitors.length > 0
Expand Down Expand Up @@ -902,7 +902,7 @@ export default class PlatformDeploy {
encodedZippedCode: code,
});
const { codeDigest } = await client.get({
actionId: match.actionkId,
actionId: match.actionId,
});

const isSchedule = (
Expand Down Expand Up @@ -933,15 +933,15 @@ export default class PlatformDeploy {
) {
return {
name: match.stackResourceId!,
id: match.actionkId,
id: match.actionId,
success: false,
response: match,
notice: `Skipped ${match.stackResourceId} - no changes detected`,
};
}

const updatesAction = await client.update({
actionId: match.actionkId,
actionId: match.actionId,
name: action.name,
paused: action.paused,
trigger: {
Expand All @@ -955,19 +955,19 @@ export default class PlatformDeploy {
if (newDigest === codeDigest) {
return {
name: match.stackResourceId!,
id: match.actionkId,
id: match.actionId,
success: true,
notice: `Skipped code upload - no changes detected for ${match.stackResourceId}`,
response: updatesAction,
};
} else {
await client.updateCodeFromFolder({
actionId: match.actionkId,
actionId: match.actionId,
path: action.path,
});
return {
name: match.stackResourceId!,
id: match.actionkId,
id: match.actionId,
success: true,
response: updatesAction,
};
Expand Down Expand Up @@ -1001,14 +1001,14 @@ export default class PlatformDeploy {
});
return {
name: stackResourceId,
id: createdAction.actionkId,
id: createdAction.actionId,
success: true,
response: createdAction,
};
},
// on remove
async (actions: PlatformAction[]) => {
await Promise.all(actions.map(async (a) => await client.delete({ actionId: a.actionkId })));
await Promise.all(actions.map(async (a) => await client.delete({ actionId: a.actionId })));
},
undefined,
output,
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export default class PlatformInfo {
'Actions',
this.resources.actions,
listActions,
(resource: PlatformAction) => `${resource.stackResourceId}: ${resource.actionkId}`,
(resource: PlatformAction) => `${resource.stackResourceId}: ${resource.actionId}`,
stdOut.actions,
);

Expand Down
2 changes: 1 addition & 1 deletion src/cmd/invoke.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default class PlatformInvoke {
const platformAction = getEquivalentResourceByKey<PlatformAction>(this.options.function!, list);
if (platformAction) {
const response = await client.runAction({
actionId: platformAction.actionkId,
actionId: platformAction.actionId,
data: payload,
});
this.log.notice(JSON.stringify(response, null, 2));
Expand Down
6 changes: 3 additions & 3 deletions src/cmd/remove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ export default class PlatformRemove {
async (actions: PlatformAction[]) => {
await Promise.all(
actions.map(async (e) => {
this.log.progress('component-remove-extra', `Removing ${e.stackResourceId} (${e.actionkId}) from Platform`);
await actionClient.delete({ actionId: e.actionkId });
this.log.success(`Removed ${e.stackResourceId} (${e.actionkId})`);
this.log.progress('component-remove-extra', `Removing ${e.stackResourceId} (${e.actionId}) from Platform`);
await actionClient.delete({ actionId: e.actionId });
this.log.success(`Removed ${e.stackResourceId} (${e.actionId})`);
}),
);
},
Expand Down
1 change: 1 addition & 0 deletions src/types/docs-schemas/definitions.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"x-dfk-avax-chain-test",
"zksync",
"zksync-goerli",
"base",
"base-goerli",
"linea-goerli"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
| `"x-dfk-avax-chain-test"` | |
| `"zksync"` | |
| `"zksync-goerli"` | |
| `"base"` | |
| `"base-goerli"` | |
| `"linea-goerli"` | |

Expand Down
1 change: 1 addition & 0 deletions src/types/docs/definitions-definitions-blockmonitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
| `"x-dfk-avax-chain-test"` | |
| `"zksync"` | |
| `"zksync-goerli"` | |
| `"base"` | |
| `"base-goerli"` | |
| `"linea-goerli"` | |

Expand Down
1 change: 1 addition & 0 deletions src/types/docs/definitions-definitions-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
| `"x-dfk-avax-chain-test"` | |
| `"zksync"` | |
| `"zksync-goerli"` | |
| `"base"` | |
| `"base-goerli"` | |
| `"linea-goerli"` | |

Expand Down
1 change: 1 addition & 0 deletions src/types/docs/definitions-definitions-fortamonitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
| `"x-dfk-avax-chain-test"` | |
| `"zksync"` | |
| `"zksync-goerli"` | |
| `"base"` | |
| `"base-goerli"` | |
| `"linea-goerli"` | |

Expand Down
1 change: 1 addition & 0 deletions src/types/docs/definitions-definitions-network.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
| `"x-dfk-avax-chain-test"` | |
| `"zksync"` | |
| `"zksync-goerli"` | |
| `"base"` | |
| `"base-goerli"` | |
| `"linea-goerli"` | |

Expand Down
1 change: 1 addition & 0 deletions src/types/docs/definitions-definitions-relayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
| `"x-dfk-avax-chain-test"` | |
| `"zksync"` | |
| `"zksync-goerli"` | |
| `"base"` | |
| `"base-goerli"` | |
| `"linea-goerli"` | |

Expand Down
5 changes: 5 additions & 0 deletions src/types/docs/definitions.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ Reference this group by using
| `"x-dfk-avax-chain-test"` | |
| `"zksync"` | |
| `"zksync-goerli"` | |
| `"base"` | |
| `"base-goerli"` | |
| `"linea-goerli"` | |

Expand Down Expand Up @@ -420,6 +421,7 @@ Reference this group by using
| `"x-dfk-avax-chain-test"` | |
| `"zksync"` | |
| `"zksync-goerli"` | |
| `"base"` | |
| `"base-goerli"` | |
| `"linea-goerli"` | |

Expand Down Expand Up @@ -1639,6 +1641,7 @@ Reference this group by using
| `"x-dfk-avax-chain-test"` | |
| `"zksync"` | |
| `"zksync-goerli"` | |
| `"base"` | |
| `"base-goerli"` | |
| `"linea-goerli"` | |

Expand Down Expand Up @@ -2003,6 +2006,7 @@ Reference this group by using
| `"x-dfk-avax-chain-test"` | |
| `"zksync"` | |
| `"zksync-goerli"` | |
| `"base"` | |
| `"base-goerli"` | |
| `"linea-goerli"` | |

Expand Down Expand Up @@ -2461,6 +2465,7 @@ Reference this group by using
| `"x-dfk-avax-chain-test"` | |
| `"zksync"` | |
| `"zksync-goerli"` | |
| `"base"` | |
| `"base-goerli"` | |
| `"linea-goerli"` | |

Expand Down
2 changes: 1 addition & 1 deletion src/types/schemas/definitions.schema.json

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/types/types/resources.schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export type Network =
| 'x-dfk-avax-chain-test'
| 'zksync'
| 'zksync-goerli'
| 'base'
| 'base-goerli'
| 'linea-goerli';
export type WhitelistReceivers = string[];
Expand Down Expand Up @@ -133,6 +134,7 @@ export type Network1 =
| 'x-dfk-avax-chain-test'
| 'zksync'
| 'zksync-goerli'
| 'base'
| 'base-goerli'
| 'linea-goerli';
export type AbiType = StringABI | ArrayABI;
Expand Down Expand Up @@ -174,6 +176,7 @@ export type Network2 =
| 'x-dfk-avax-chain-test'
| 'zksync'
| 'zksync-goerli'
| 'base'
| 'base-goerli'
| 'linea-goerli';
export type Address1 = string;
Expand Down Expand Up @@ -217,6 +220,7 @@ export type Network3 =
| 'x-dfk-avax-chain-test'
| 'zksync'
| 'zksync-goerli'
| 'base'
| 'base-goerli'
| 'linea-goerli';
export type Address2 = string;
Expand Down Expand Up @@ -259,6 +263,7 @@ export type Network4 =
| 'x-dfk-avax-chain-test'
| 'zksync'
| 'zksync-goerli'
| 'base'
| 'base-goerli'
| 'linea-goerli';

Expand Down
4 changes: 2 additions & 2 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ export const constructMonitor = (
addresses: monitor.addresses,
abi: monitor.abi && JSON.stringify(typeof monitor.abi === 'string' ? JSON.parse(monitor.abi) : monitor.abi),
paused: monitor.paused,
autotaskCondition: actionCondition && actionCondition.actionkId,
autotaskTrigger: actionTrigger && actionTrigger.actionkId,
autotaskCondition: actionCondition && actionCondition.actionId,
autotaskTrigger: actionTrigger && actionTrigger.actionId,
alertThreshold: threshold && {
amount: threshold.amount,
windowSeconds: threshold['window-seconds'],
Expand Down
Loading

0 comments on commit c986d35

Please sign in to comment.