Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release/10' into ccd-js-gen-sche…
Browse files Browse the repository at this point in the history
…ma-param
  • Loading branch information
limemloh committed Oct 2, 2023
2 parents 1bc31b7 + f0942d2 commit ac9f4ec
Show file tree
Hide file tree
Showing 41 changed files with 402 additions and 2,822 deletions.
16 changes: 14 additions & 2 deletions examples/ccd-js-gen/wCCD/client-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { parseEndpoint } from '../../shared/util.js';
// The generated module could be imported directly like below,
// but for this example it is imported dynamicly to improve
// the error message when not generated.
import * as wCCDContractClient from './lib/cis2_wCCD.js';
// import * as wCCDContractClient from './lib/cis2_wCCD.js';

const cli = meow(
`
Expand Down Expand Up @@ -57,7 +57,19 @@ const contractAddress = SDK.ContractAddress.create(
);

(async () => {
const parameter: wCCDContractClient.UpdateOperatorParameter = [
// Importing the generated smart contract module client.
/* eslint-disable import/no-unresolved */
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const wCCDContractClient = await import('./lib/cis2_wCCD.js').catch((e) => {
/* eslint-enable import/no-unresolved */
console.error(
'\nFailed to load the generated wCCD module, did you run the `generate` script?\n'
);
throw e;
});

const parameter = [
{
update: { type: 'Add' },
operator: { type: 'Contract', content: contractAddress },
Expand Down
18 changes: 16 additions & 2 deletions packages/common/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
- `@concordium/common-sdk/cis4` entrypoint exposes functionality for working with contracts adhering to the [CIS-4](https://proposals.concordium.software/CIS/cis-4.html) standard.
- `@concordium/common-sdk/grpc` entrypoint exposes the grpc client for interacting with a nodes GRPCv2 interface.
- `@concordium/common-sdk/id` entrypoint exposes functionality for working with ID proofs.
- `@concordium/common-sdk/json-rpc` entrypoint exposes the **(deprecated)** json-rpc client for interacting with a nodes GPRCv1 interface.
- `@concordium/common-sdk/schema` entrypoint exposes functionality for working with smart contract schemas, i.e.(de)serializing types using a smart contract schema.
- This uses the wasm entrypoint at `@concordium/rust-bindings/dapp`.
- `@concordium/common-sdk/types` entrypoint exposes functionality for working with concordium domain types.
Expand All @@ -23,7 +22,6 @@
- For TypeScript projects the minimum required version of typescript is:
- NodeJS: 4.7, `"moduleResolution": "node16" // or "nodenext"`
- Bundled applications (webpack, esbuild, rollup, etc...): 5.0, `"moduleResolution": "bundler"`

- The following functions now parse using `json-bigint` meaning that they return bigints instead of numbers _for all numbers no matter size_
- `deserializeContractState`
- `deserializeReceiveReturnValue`
Expand Down Expand Up @@ -57,6 +55,7 @@ Several types have been replaced with a module containing the type itself togeth
- `CredentialRegistrationId` is now a module with functions related to credential registration IDs:
- To refer to `CredentialRegistrationId` as a type use `CredentialRegistrationId.Type`.
- Constructing `new CredentialRegistrationId("<hex-string>")` is now `CredentialRegistrationId.fromHexString("<hex-string>")`.
- Removed `JsonRpcClient` and types and functionality associated solely with this class.

- Renamed `AccountSequenceNumber` module to `SequenceNumber`.
- Fix type for `TranferredEvent` from `ContractTraceEvent` to only be from contract addresses to account addresses.
Expand All @@ -71,6 +70,21 @@ Several types have been replaced with a module containing the type itself togeth
- `ReceiveName` is now a module with functions related to receive-function names of a smart contract.
- `ReturnValue` is now a module with functions related to return values from invoking a smart contract.

### Changes

- Added version discriminators to types versioned by the protocol version of Concordium nodes:
- `MintDistribution`
- `GasRewards`
- `RewardParameters`
- `ChainParameters`
- `Authorizations`
- `RewardStatus`
- `BlockInfo`
- `ConsensusStatus`
- `AccountBakerDetails`
- `ElectionInfo`
- Added type discriminator to different forms of `AccountInfo`.

## 9.4.0

### Added
Expand Down
41 changes: 30 additions & 11 deletions packages/common/src/accountHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,44 @@ import {
AccountInfo,
AccountInfoBaker,
AccountInfoDelegator,
StakePendingChange,
AccountInfoType,
StakePendingChangeType,
} from './types.js';

/** Whether {@link AccountInfo} parameter given is of type {@link AccountInfoDelegator}, i.e. the account is a delegator */
/**
* Whether {@link AccountInfo} parameter given is of type {@link AccountInfoDelegator}, i.e. the account is a delegator
*
* @deprecated check `type` member instead.
*/
export const isDelegatorAccount = (
ai: AccountInfo
): ai is AccountInfoDelegator =>
(ai as AccountInfoDelegator).accountDelegation !== undefined;
): ai is AccountInfoDelegator => ai.type === AccountInfoType.Delegator;

/** Whether {@link AccountInfo} parameter given is of type {@link AccountInfoBaker}, i.e. the account is a baker. */
/**
* Whether {@link AccountInfo} parameter given is of type {@link AccountInfoBaker}, i.e. the account is a baker.
*
* @deprecated check `type` member instead.
*/
export const isBakerAccount = (ai: AccountInfo): ai is AccountInfoBaker =>
(ai as AccountInfoBaker).accountBaker !== undefined;
ai.type === AccountInfoType.Baker;

/** Whether the pending change given is of type {@link ReduceStakePendingChange} */
/**
* Whether the pending change given is of type {@link ReduceStakePendingChange}
*
* @deprecated check `change` member instead.
*/
export const isReduceStakePendingChange = (
spc: ReduceStakePendingChange | RemovalPendingChange
spc: StakePendingChange
): spc is ReduceStakePendingChange =>
(spc as ReduceStakePendingChange).newStake !== undefined;
spc.change === StakePendingChangeType.ReduceStake;

/** Whether the pending change given is of type {@link RemovalPendingChange} */
/**
* Whether the pending change given is of type {@link RemovalPendingChange}
*
* @deprecated check `change` member instead.
*/
export const isRemovalPendingChange = (
spc: ReduceStakePendingChange | RemovalPendingChange
): spc is RemovalPendingChange => !isReduceStakePendingChange(spc);
spc: StakePendingChange
): spc is RemovalPendingChange =>
spc.change === StakePendingChangeType.RemoveStake;
46 changes: 0 additions & 46 deletions packages/common/src/blockSummaryHelpers.ts

This file was deleted.

Loading

0 comments on commit ac9f4ec

Please sign in to comment.