Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@
with `buildAccountSigner`
- A new optional field `createPlt` to `AuthorizationsV1` which exposes the access structure for PLT creation.

## 10.0.0-alpha.13

### Changed

- Disable `denyList`/`allowList` validation on plt token transfers.

## 10.0.0-alpha.12

### Breaking changes
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@concordium/web-sdk",
"version": "10.0.0-alpha.12",
"version": "10.0.0-alpha.13",
"license": "Apache-2.0",
"engines": {
"node": ">=16"
Expand Down
43 changes: 23 additions & 20 deletions packages/sdk/src/plt/Token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
TokenAddDenyListOperation,
TokenBurnOperation,
TokenMintOperation,
TokenModuleAccountState,

Check warning on line 21 in packages/sdk/src/plt/Token.ts

View workflow job for this annotation

GitHub Actions / JS lint

'TokenModuleAccountState' is defined but never used
TokenModuleState,
TokenOperation,
TokenOperationType,
Expand Down Expand Up @@ -375,26 +375,29 @@
throw new InsufficientFundsError(sender, TokenAmount.fromDecimal(payloadTotal, decimals));
}

if (!token.moduleState.allowList && !token.moduleState.denyList) {
// If the token neither has a deny list nor allow list, we can skip the check.
return true;
}

// Check that sender and all receivers are NOT on the deny list (if present), or that they are included in the allow list (if present).
const receiverInfos = await Promise.all(payloads.map((p) => token.grpc.getAccountInfo(p.recipient.address)));
const accounts = [senderInfo, ...receiverInfos];
accounts.forEach((r) => {
const accountToken = r.accountTokens.find((t) => t.id.value === token.info.id.value)?.state;
const accountModuleState =
accountToken?.moduleState === undefined
? undefined
: (Cbor.decode(accountToken.moduleState) as TokenModuleAccountState);

if (token.moduleState.denyList && accountModuleState?.denyList)
throw new NotAllowedError(TokenHolder.fromAccountAddress(r.accountAddress));
if (token.moduleState.allowList && !accountModuleState?.allowList)
throw new NotAllowedError(TokenHolder.fromAccountAddress(r.accountAddress));
});
// FIXME: This is currently disable as a hacky-fix until some changes in the node are implemented/released.
// https://linear.app/concordium/issue/COR-1650/empty-deny-list-blocking-transfer

// if (!token.moduleState.allowList && !token.moduleState.denyList) {
// // If the token neither has a deny list nor allow list, we can skip the check.
// return true;
// }

// // Check that sender and all receivers are NOT on the deny list (if present), or that they are included in the allow list (if present).
// const receiverInfos = await Promise.all(payloads.map((p) => token.grpc.getAccountInfo(p.recipient.address)));
// const accounts = [senderInfo, ...receiverInfos];
// accounts.forEach((r) => {
// const accountToken = r.accountTokens.find((t) => t.id.value === token.info.id.value)?.state;
// const accountModuleState =
// accountToken?.moduleState === undefined
// ? undefined
// : (Cbor.decode(accountToken.moduleState) as TokenModuleAccountState);

// if (token.moduleState.denyList && accountModuleState?.denyList)
// throw new NotAllowedError(TokenHolder.fromAccountAddress(r.accountAddress));
// if (token.moduleState.allowList && !accountModuleState?.allowList)
// throw new NotAllowedError(TokenHolder.fromAccountAddress(r.accountAddress));
// });

return true;
}
Expand Down
Loading