diff --git a/scripts/transactions.json b/scripts/transactions.json index 806a1578e6..6e666d2c98 100644 --- a/scripts/transactions.json +++ b/scripts/transactions.json @@ -258,7 +258,8 @@ "claim_classic_ticker": "claim_classic_ticker", "add_documents": "add_documents", "remove_documents": "remove_documents", - "reserve_classic_ticker": "reserve_classic_ticker" + "reserve_classic_ticker": "reserve_classic_ticker", + "register_custom_asset_type": "register_custom_asset_type" }, "Dividend": { "new": "new", @@ -329,7 +330,9 @@ "batch_unfreeze_tx": "batch_unfreeze_tx", "freeze_txs": "freeze_txs", "unfreeze_txs": "unfreeze_txs", - "handle_scheduled_bridge_tx": "handle_scheduled_bridge_tx" + "handle_scheduled_bridge_tx": "handle_scheduled_bridge_tx", + "add_freeze_admin": "add_freeze_admin", + "remove_freeze_admin": "remove_freeze_admin" }, "ComplianceManager": { "add_active_rule": "add_active_rule", @@ -387,7 +390,9 @@ "affirm_with_receipts": "affirm_with_receipts", "execute_scheduled_instruction": "execute_scheduled_instruction", "change_receipt_validity": "change_receipt_validity", - "reschedule_instruction": "reschedule_instruction" + "reschedule_instruction": "reschedule_instruction", + "update_venue_details": "update_venue_details", + "update_venue_type": "update_venue_type" }, "Sto": { "create_fundraiser": "create_fundraiser", @@ -422,7 +427,8 @@ "delete_portfolio": "delete_portfolio", "move_portfolio_funds": "move_portfolio_funds", "rename_portfolio": "rename_portfolio", - "quit_portfolio_custody": "quit_portfolio_custody" + "quit_portfolio_custody": "quit_portfolio_custody", + "accept_portfolio_custody": "accept_portfolio_custody" }, "Confidential": { "add_range_proof": "add_range_proof", @@ -485,6 +491,19 @@ "set_group_permissions": "set_group_permissions", "remove_agent": "remove_agent", "abdicate": "abdicate", - "change_group": "change_group" + "change_group": "change_group", + "accept_become_agent": "accept_become_agent" + }, + "Relayer": { + "set_paying_key": "set_paying_key", + "accept_paying_key": "accept_paying_key", + "remove_paying_key": "remove_paying_key", + "update_polyx_limit": "update_polyx_limit", + "increase_polyx_limit": "increase_polyx_limit", + "decrease_polyx_limit": "decrease_polyx_limit" + }, + "Rewards": { + "claim_itn_reward": "claim_itn_reward", + "set_itn_reward_status": "set_itn_reward_status" } } diff --git a/src/api/entities/CorporateAction/index.ts b/src/api/entities/CorporateAction/index.ts index 36b1fbd345..3419793f57 100644 --- a/src/api/entities/CorporateAction/index.ts +++ b/src/api/entities/CorporateAction/index.ts @@ -110,8 +110,8 @@ export class CorporateAction extends Entity { const { kind, declarationDate, - description, targets, + description, defaultTaxWithholding, taxWithholdings, ...identifiers diff --git a/src/api/entities/SecurityToken/index.ts b/src/api/entities/SecurityToken/index.ts index 2dfde9e96f..3f552e3034 100644 --- a/src/api/entities/SecurityToken/index.ts +++ b/src/api/entities/SecurityToken/index.ts @@ -37,7 +37,6 @@ import { import { MAX_TICKER_LENGTH } from '~/utils/constants'; import { assetIdentifierToTokenIdentifier, - assetNameToString, assetTypeToString, balanceToBigNumber, boolToBoolean, @@ -211,7 +210,7 @@ export class SecurityToken extends Entity { /* eslint-disable @typescript-eslint/naming-convention */ const assembleResult = ( - { name, total_supply, divisible, owner_did, asset_type }: MeshSecurityToken, + { total_supply, divisible, owner_did, asset_type }: MeshSecurityToken, agentGroups: [StorageKey<[Ticker, IdentityId]>, Option][] ): SecurityTokenDetails => { const primaryIssuanceAgents: Identity[] = []; @@ -232,7 +231,7 @@ export class SecurityToken extends Entity { return { assetType: assetTypeToString(asset_type), isDivisible: boolToBoolean(divisible), - name: assetNameToString(name), + name: 'placeholder', owner, totalSupply: balanceToBigNumber(total_supply), primaryIssuanceAgents, diff --git a/src/api/procedures/__tests__/configureDividendDistribution.ts b/src/api/procedures/__tests__/configureDividendDistribution.ts index 512a752b75..3f68696941 100644 --- a/src/api/procedures/__tests__/configureDividendDistribution.ts +++ b/src/api/procedures/__tests__/configureDividendDistribution.ts @@ -537,7 +537,6 @@ describe('configureDividendDistribution procedure', () => { Scheduled: [dsMockUtils.createMockU64(1), dsMockUtils.createMockU64(2)], }, }), - details: description, targets, default_withholding_tax: defaultTaxWithholding.shiftedBy(4).toNumber(), withholding_tax: taxWithholdings.map(({ identity, percentage }) => @@ -561,6 +560,9 @@ describe('configureDividendDistribution procedure', () => { dsMockUtils.createQueryStub('corporateAction', 'corporateActions', { returnValue: dsMockUtils.createMockOption(rawCorporateAction), }); + dsMockUtils.createQueryStub('corporateAction', 'details', { + returnValue: dsMockUtils.createMockText(description), + }); }); beforeEach(() => { diff --git a/src/api/procedures/__tests__/createSecurityToken.ts b/src/api/procedures/__tests__/createSecurityToken.ts index f08f92e88f..1ae600bb56 100644 --- a/src/api/procedures/__tests__/createSecurityToken.ts +++ b/src/api/procedures/__tests__/createSecurityToken.ts @@ -71,6 +71,7 @@ describe('createSecurityToken procedure', () => { let rawType: AssetType; let rawIdentifiers: AssetIdentifier[]; let rawFundingRound: FundingRoundName; + let rawDisableIu: bool; let rawDocuments: Document[]; let args: Params; @@ -142,6 +143,7 @@ describe('createSecurityToken procedure', () => { }) ); rawFundingRound = dsMockUtils.createMockFundingRoundName(fundingRound); + rawDisableIu = dsMockUtils.createMockBool(false); args = { ticker, name, @@ -241,7 +243,8 @@ describe('createSecurityToken procedure', () => { rawIsDivisible, rawType, rawIdentifiers, - rawFundingRound + rawFundingRound, + rawDisableIu ); expect(result).toMatchObject(entityMockUtils.getSecurityTokenInstance({ ticker })); @@ -261,7 +264,8 @@ describe('createSecurityToken procedure', () => { rawIsDivisible, rawType, [], - null + null, + rawDisableIu ); const issueTransaction = dsMockUtils.createTxStub('asset', 'issue'); @@ -295,7 +299,8 @@ describe('createSecurityToken procedure', () => { rawIsDivisible, rawType, rawIdentifiers, - rawFundingRound + rawFundingRound, + rawDisableIu ); expect(result).toMatchObject(entityMockUtils.getSecurityTokenInstance({ ticker })); }); diff --git a/src/api/procedures/__tests__/modifyVenue.ts b/src/api/procedures/__tests__/modifyVenue.ts index 303d930f32..fe82977fb0 100644 --- a/src/api/procedures/__tests__/modifyVenue.ts +++ b/src/api/procedures/__tests__/modifyVenue.ts @@ -109,26 +109,43 @@ describe('modifyVenue procedure', () => { sinon.stub(utilsConversionModule, 'stringToVenueDetails').returns(rawDetails); sinon.stub(utilsConversionModule, 'venueTypeToMeshVenueType').returns(rawType); - const transaction = dsMockUtils.createTxStub('settlement', 'updateVenue'); + const updateVenueDetailsTransaction = dsMockUtils.createTxStub( + 'settlement', + 'updateVenueDetails' + ); + const updateVenueTypeTransaction = dsMockUtils.createTxStub('settlement', 'updateVenueType'); const proc = procedureMockUtils.getInstance(mockContext); await prepareModifyVenue.call(proc, args); - sinon.assert.calledWith(addTransactionStub, transaction, {}, rawId, rawDetails, rawType); + sinon.assert.calledWith( + addTransactionStub, + updateVenueDetailsTransaction, + {}, + rawId, + rawDetails + ); + sinon.assert.calledWith(addTransactionStub, updateVenueTypeTransaction, {}, rawId, rawType); await prepareModifyVenue.call(proc, { venueId, type, }); - sinon.assert.calledWith(addTransactionStub, transaction, {}, rawId, null, rawType); + sinon.assert.calledWith(addTransactionStub, updateVenueTypeTransaction, {}, rawId, rawType); await prepareModifyVenue.call(proc, { venueId, description, }); - sinon.assert.calledWith(addTransactionStub, transaction, {}, rawId, rawDetails, null); + sinon.assert.calledWith( + addTransactionStub, + updateVenueDetailsTransaction, + {}, + rawId, + rawDetails + ); }); describe('getAuthorization', () => { diff --git a/src/api/procedures/configureDividendDistribution.ts b/src/api/procedures/configureDividendDistribution.ts index 7857ee4c40..f4665c2f3f 100644 --- a/src/api/procedures/configureDividendDistribution.ts +++ b/src/api/procedures/configureDividendDistribution.ts @@ -38,18 +38,21 @@ export const createDividendDistributionResolver = (context: Context) => async ( receipt: ISubmittableResult ): Promise => { const [{ data }] = filterEventRecords(receipt, 'capitalDistribution', 'Created'); - const [, { ticker, local_id: localId }, distribution] = data; + const [, caId, distribution] = data; + const { ticker, local_id: localId } = caId; - const corporateAction = await context.polymeshApi.query.corporateAction.corporateActions( - ticker, - localId - ); + const { corporateAction } = context.polymeshApi.query; + + const [corpAction, details] = await Promise.all([ + corporateAction.corporateActions(ticker, localId), + corporateAction.details(caId), + ]); return new DividendDistribution( { ticker: tickerToString(ticker), id: u32ToBigNumber(localId), - ...meshCorporateActionToCorporateActionParams(corporateAction.unwrap(), context), + ...meshCorporateActionToCorporateActionParams(corpAction.unwrap(), details, context), ...distributionToDividendDistributionParams(distribution, context), }, context diff --git a/src/api/procedures/consumeAddMultisigSignerAuthorization.ts b/src/api/procedures/consumeAddMultisigSignerAuthorization.ts new file mode 100644 index 0000000000..fe77fbe95c --- /dev/null +++ b/src/api/procedures/consumeAddMultisigSignerAuthorization.ts @@ -0,0 +1,132 @@ +import { TxTag, TxTags } from 'polymesh-types/types'; + +import { PolymeshError } from '~/base/PolymeshError'; +import { Account, AuthorizationRequest, Procedure } from '~/internal'; +import { ErrorCode, Role } from '~/types'; +import { ProcedureAuthorization } from '~/types/internal'; +import { + booleanToBool, + numberToU64, + signerToSignerValue, + signerToString, + signerValueToSignatory, +} from '~/utils/conversion'; +import { getDid } from '~/utils/internal'; + +/** + * @hidden + */ +export type ConsumeAddMultisigSignerAuthorizationParams = { + authRequest: AuthorizationRequest; + accept: boolean; +}; + +/** + * @hidden + */ +export async function prepareConsumeAddMultisigSignerAuthorization( + this: Procedure, + args: ConsumeAddMultisigSignerAuthorizationParams +): Promise { + const { + context: { + polymeshApi: { + tx: { multiSig, identity }, + }, + }, + context, + } = this; + const { authRequest, accept } = args; + + const { target, authId, expiry } = authRequest; + + if (authRequest.isExpired()) { + throw new PolymeshError({ + code: ErrorCode.ValidationError, + message: 'The Authorization Request has expired', + data: { + expiry, + }, + }); + } + + let transaction; + + const rawAuthId = numberToU64(authId, context); + + if (!accept) { + this.addTransaction( + identity.removeAuthorization, + {}, + signerValueToSignatory(signerToSignerValue(target), context), + rawAuthId, + booleanToBool(false, context) + ); + + return; + } + + if (target instanceof Account) { + transaction = multiSig.acceptMultisigSignerAsKey; + } else { + transaction = multiSig.acceptMultisigSignerAsIdentity; + } + + this.addTransaction(transaction, {}, rawAuthId); +} + +/** + * @hidden + */ +export async function getAuthorization( + this: Procedure, + { authRequest, accept }: ConsumeAddMultisigSignerAuthorizationParams +): Promise { + const { target, issuer } = authRequest; + const { context } = this; + + let condition; + let did: string | undefined; + const fetchDid = async (): Promise => getDid(did, context); + + let transactions: TxTag[]; + + let roles: Role[] | boolean; + + if (target instanceof Account) { + const { address } = context.getCurrentAccount(); + condition = address === target.address; + transactions = [TxTags.multiSig.AcceptMultisigSignerAsKey]; + } else { + did = await fetchDid(); + condition = did === target.did; + transactions = [TxTags.multiSig.AcceptMultisigSignerAsIdentity]; + } + + if (!accept) { + transactions = [TxTags.identity.RemoveAuthorization]; + try { + did = await fetchDid(); + } catch (err) { + // do nothing + } + condition = condition || did === issuer.did; + } + + if (bypassSignerPermissions) { + return { + roles, + }; + } + + return { + roles, + permissions: { transactions, tokens: [], portfolios: [] }, + }; +} + +/** + * @hidden + */ +export const consumeAddMultisigSignerAuthorization = (): Procedure => + new Procedure(prepareConsumeAddMultisigSignerAuthorization, getAuthorization); diff --git a/src/api/procedures/consumeAuthorizationRequests.ts b/src/api/procedures/consumeAuthorizationRequests.ts index a50375a697..0b895e6a5d 100644 --- a/src/api/procedures/consumeAuthorizationRequests.ts +++ b/src/api/procedures/consumeAuthorizationRequests.ts @@ -1,7 +1,9 @@ +import { u64 } from '@polkadot/types'; import P from 'bluebird'; +import { PolymeshError } from '~/base/PolymeshError'; import { Account, AuthorizationRequest, Procedure } from '~/internal'; -import { TxTags } from '~/types'; +import { AuthorizationType, ErrorCode, TxTags } from '~/types'; import { ProcedureAuthorization } from '~/types/internal'; import { tuple } from '~/types/utils'; import { @@ -41,6 +43,66 @@ export async function prepareConsumeAuthorizationRequests( const liveRequests = authRequests.filter(request => !request.isExpired()); if (accept) { + const addMultisigSignerIds: [u64][] = []; + const attestPrimaryKeyRotationIds: [u64][] = []; + const becomeAgentIds: [u64][] = []; + const joinIdentityIds: [u64][] = []; + const addRelayerPayingKeyIds: [u64][] = []; + const portfolioCustodyIds: [u64][] = []; + const rotatePrimaryKeyIds: [u64][] = []; + const transferAssetOwnershpIds: [u64][] = []; + const transferTickerIds: [u64][] = []; + + liveRequests.forEach(({ authId, data: { type } }) => { + const id = tuple(numberToU64(authId, context)); + switch (type) { + case AuthorizationType.AddMultiSigSigner: { + addMultisigSignerIds.push(id); + break; + } + case AuthorizationType.AttestPrimaryKeyRotation: { + attestPrimaryKeyRotationIds.push(id); + break; + } + case AuthorizationType.BecomeAgent: { + becomeAgentIds.push(id); + break; + } + case AuthorizationType.JoinIdentity: { + joinIdentityIds.push(id); + break; + } + case AuthorizationType.AddRelayerPayingKey: { + addRelayerPayingKeyIds.push(id); + break; + } + case AuthorizationType.PortfolioCustody: { + portfolioCustodyIds.push(id); + break; + } + case AuthorizationType.RotatePrimaryKey: { + rotatePrimaryKeyIds.push(id); + break; + } + case AuthorizationType.TransferAssetOwnership: { + transferAssetOwnershpIds.push(id); + break; + } + case AuthorizationType.TransferTicker: { + transferTickerIds.push(id); + break; + } + default: { + throw new PolymeshError({ + code: ErrorCode.ValidationError, + message: 'Attempting to accept a deprecated Authorization type', + data: { + type, + }, + }); + } + } + }); const requestIds = liveRequests.map(({ authId }) => tuple(numberToU64(authId, context))); this.addBatchTransaction(tx.identity.acceptAuthorization, {}, requestIds); } else { diff --git a/src/api/procedures/createSecurityToken.ts b/src/api/procedures/createSecurityToken.ts index a39e4909b4..a01a329e53 100644 --- a/src/api/procedures/createSecurityToken.ts +++ b/src/api/procedures/createSecurityToken.ts @@ -130,7 +130,8 @@ export async function prepareCreateSecurityToken( rawIsDivisible, rawType, rawIdentifiers, - rawFundingRound + rawFundingRound, + booleanToBool(false, context) ); if (totalSupply && totalSupply.gt(0)) { diff --git a/src/api/procedures/modifyVenue.ts b/src/api/procedures/modifyVenue.ts index 38743f4939..4ba2223c4b 100644 --- a/src/api/procedures/modifyVenue.ts +++ b/src/api/procedures/modifyVenue.ts @@ -4,7 +4,6 @@ import { PolymeshError, Procedure, Venue } from '~/internal'; import { ErrorCode, RoleType, TxTags, VenueType } from '~/types'; import { ProcedureAuthorization } from '~/types/internal'; import { numberToU64, stringToVenueDetails, venueTypeToMeshVenueType } from '~/utils/conversion'; -import { optionize } from '~/utils/internal'; export type ModifyVenueParams = | { @@ -59,13 +58,23 @@ export async function prepareModifyVenue( }); } - this.addTransaction( - tx.settlement.updateVenue, - {}, - numberToU64(venueId, context), - optionize(stringToVenueDetails)(description, context), - optionize(venueTypeToMeshVenueType)(type, context) - ); + if (description) { + this.addTransaction( + tx.settlement.updateVenueDetails, + {}, + numberToU64(venueId, context), + stringToVenueDetails(description, context) + ); + } + + if (type) { + this.addTransaction( + tx.settlement.updateVenueType, + {}, + numberToU64(venueId, context), + venueTypeToMeshVenueType(type, context) + ); + } } /** diff --git a/src/base/Context.ts b/src/base/Context.ts index ea51677027..bac8d4beb0 100644 --- a/src/base/Context.ts +++ b/src/base/Context.ts @@ -683,8 +683,9 @@ export class Context { ([, action]) => action.unwrap().kind.isUnpredictableBenefit ); - unpredictableCas.forEach( - ([ + const corporateActionData = await P.map( + unpredictableCas, + async ([ { args: [rawTicker, rawId], }, @@ -692,13 +693,25 @@ export class Context { ]) => { const localId = u32ToBigNumber(rawId); const ticker = tickerToString(rawTicker); - tickers.push(ticker); - corporateActionIds.push(localId); - distributionsMultiParams.push(corporateActionIdentifierToCaId({ ticker, localId }, this)); + const caId = corporateActionIdentifierToCaId({ ticker, localId }, this); + const details = await query.corporateAction.details(caId); const action = corporateAction.unwrap(); - corporateActionParams.push(meshCorporateActionToCorporateActionParams(action, this)); + + return { + ticker, + localId, + caId, + corporateAction: meshCorporateActionToCorporateActionParams(action, details, this), + }; } ); + + corporateActionData.forEach(({ ticker, localId, caId, corporateAction }) => { + tickers.push(ticker); + corporateActionIds.push(localId); + distributionsMultiParams.push(caId); + corporateActionParams.push(corporateAction); + }); }); /* diff --git a/src/base/__tests__/Context.ts b/src/base/__tests__/Context.ts index fd637ef1b2..9725eef440 100644 --- a/src/base/__tests__/Context.ts +++ b/src/base/__tests__/Context.ts @@ -1572,7 +1572,6 @@ describe('Context class', () => { date: new Date('10/14/2019').getTime(), checkpoint: { Existing: dsMockUtils.createMockU64(2) }, }), - details: 'someDescription', targets: { identities: ['someDid'], treatment: TargetTreatment.Exclude, @@ -1586,7 +1585,6 @@ describe('Context class', () => { kind: CorporateActionKind.Reorganization, decl_date: new Date('10/14/1987').getTime(), record_date: null, - details: 'dummy', targets: { identities: [], treatment: TargetTreatment.Exclude, @@ -1603,7 +1601,6 @@ describe('Context class', () => { date: new Date('11/26/2019').getTime(), checkpoint: { Existing: dsMockUtils.createMockU64(5) }, }), - details: 'otherDescription', targets: { identities: [], treatment: TargetTreatment.Exclude, diff --git a/src/polkadot/augment-api-errors.ts b/src/polkadot/augment-api-errors.ts index a941974cd4..245a459d94 100644 --- a/src/polkadot/augment-api-errors.ts +++ b/src/polkadot/augment-api-errors.ts @@ -30,6 +30,10 @@ declare module '@polkadot/api/types/errors' { * An overflow while calculating the balance. **/ BalanceOverflow: AugmentedError; + /** + * An overflow while generating the next `CustomAssetTypeId`. + **/ + CustomAssetTypeIdOverflow: AugmentedError; /** * When extension is already added. **/ @@ -70,10 +74,6 @@ declare module '@polkadot/api/types/errors' { * Maximum length of asset name has been exceeded. **/ MaxLengthOfAssetNameExceeded: AugmentedError; - /** - * Not a primary issuance agent transfer auth. - **/ - NoPrimaryIssuanceAgentTransferAuth: AugmentedError; /** * No such token. **/ @@ -86,10 +86,6 @@ declare module '@polkadot/api/types/errors' { * The given Document does not exist. **/ NoSuchDoc: AugmentedError; - /** - * No such smart extension. - **/ - NoSuchSmartExtension: AugmentedError; /** * Not an owner of the token. **/ @@ -98,14 +94,6 @@ declare module '@polkadot/api/types/errors' { * The asset must be frozen. **/ NotFrozen: AugmentedError; - /** - * Not a ticker transfer auth. - **/ - NoTickerTransferAuth: AugmentedError; - /** - * Not a token ownership transfer auth. - **/ - NotTickerOwnershipTransferAuth: AugmentedError; /** * Transfers to self are not allowed **/ @@ -608,6 +596,10 @@ declare module '@polkadot/api/types/errors' { TooSoon: AugmentedError; }; identity: { + /** + * The account key is being used, it can't be unlinked. + **/ + AccountKeyIsBeingUsed: AugmentedError; /** * One secondary or primary key can only belong to one DID **/ @@ -736,10 +728,6 @@ declare module '@polkadot/api/types/errors' { * Only CDD service providers are allowed. **/ UnAuthorizedCddProvider: AugmentedError; - /** - * Given authorization is not pre-known - **/ - UnknownAuthorization: AugmentedError; }; imOnline: { /** @@ -804,10 +792,6 @@ declare module '@polkadot/api/types/errors' { * No such multisig. **/ NoSuchMultisig: AugmentedError; - /** - * Not a multisig authorization. - **/ - NotAMultisigAuth: AugmentedError; /** * Not a signer. **/ @@ -1013,11 +997,63 @@ declare module '@polkadot/api/types/errors' { * Insufficient account balance to pay the fee. **/ InsufficientAccountBalance: AugmentedError; + /** + * Insufficient subsidy balance to pay the fee. + **/ + InsufficientSubsidyBalance: AugmentedError; /** * Not able to handled the imbalances **/ UnHandledImbalances: AugmentedError; }; + relayer: { + /** + * The `user_key` doesn't have a `paying_key`. + **/ + NoPayingKey: AugmentedError; + /** + * The signer is not authorized for `paying_key`. + **/ + NotAuthorizedForPayingKey: AugmentedError; + /** + * The signer is not authorized for `user_key`. + **/ + NotAuthorizedForUserKey: AugmentedError; + /** + * The `user_key` has a different `paying_key`. + **/ + NotPayingKey: AugmentedError; + /** + * The remaining POLYX for `user_key` overflowed. + **/ + Overflow: AugmentedError; + /** + * The `user_key` is not attached to a CDD'd identity. + **/ + PayingKeyCddMissing: AugmentedError; + /** + * The `user_key` is not attached to a CDD'd identity. + **/ + UserKeyCddMissing: AugmentedError; + }; + rewards: { + /** + * Provided signature was invalid. + **/ + InvalidSignature: AugmentedError; + /** + * Itn reward was already claimed. + **/ + ItnRewardAlreadyClaimed: AugmentedError; + /** + * Balance can not be converted to a primitive. + **/ + UnableToCovertBalance: AugmentedError; + /** + * Address was not found in the list of Itn addresses. + **/ + UnknownItnAddress: AugmentedError; + }; scheduler: { /** * Failed to schedule a call diff --git a/src/polkadot/augment-api-events.ts b/src/polkadot/augment-api-events.ts index a8d2380f5f..8cad1df735 100644 --- a/src/polkadot/augment-api-events.ts +++ b/src/polkadot/augment-api-events.ts @@ -38,10 +38,12 @@ import type { BallotTimeRange, BallotVote, BridgeTx, + CADetails, CAId, CheckpointId, ComplianceRequirement, CorporateAction, + CustomAssetTypeId, DispatchableName, Distribution, Document, @@ -79,8 +81,6 @@ import type { Signatory, SkippedCount, SlashingSwitch, - SmartExtensionName, - SmartExtensionType, SnapshotId, SnapshottedPip, StoredSchedule, @@ -132,6 +132,16 @@ declare module '@polkadot/api/types/events' { * caller DID/ controller DID, ticker, Portfolio of token holder, value. **/ ControllerTransfer: AugmentedEvent; + /** + * A custom asset type already exists on-chain. + * caller DID, the ID of the custom asset type, the string contents registered. + **/ + CustomAssetTypeExists: AugmentedEvent; + /** + * A custom asset type was registered on-chain. + * caller DID, the ID of the custom asset type, the string contents registered. + **/ + CustomAssetTypeRegistered: AugmentedEvent; /** * Event for change in divisibility. * caller DID, ticker, divisibility @@ -145,29 +155,11 @@ declare module '@polkadot/api/types/events' { * A document removed from an asset **/ DocumentRemoved: AugmentedEvent; - /** - * Emitted when extension is added successfully. - * caller DID, ticker, extension AccountId, extension name, type of smart Extension - **/ - ExtensionAdded: AugmentedEvent< - ApiType, - [IdentityId, Ticker, AccountId, SmartExtensionName, SmartExtensionType] - >; - /** - * Emitted when extension get archived. - * caller DID, ticker, AccountId - **/ - ExtensionArchived: AugmentedEvent; /** * A extension got removed. * caller DID, ticker, AccountId **/ ExtensionRemoved: AugmentedEvent; - /** - * Emitted when extension get archived. - * caller DID, ticker, AccountId - **/ - ExtensionUnArchived: AugmentedEvent; /** * An event carrying the name of the current funding round of a ticker. * Parameters: caller DID, ticker, funding round name. @@ -272,17 +264,21 @@ declare module '@polkadot/api/types/events' { **/ AdminChanged: AugmentedEvent; /** - * Confirmation of POLYX upgrade on Polymesh from POLY tokens on Ethereum + * Confirmation of POLYX upgrade on Polymesh from POLY tokens on Ethereum. **/ Bridged: AugmentedEvent; /** - * Bridge limit has been updated + * Bridge limit has been updated. **/ BridgeLimitUpdated: AugmentedEvent; /** - * Bridge Tx Scheduled + * Bridge Tx Scheduled. **/ BridgeTxScheduled: AugmentedEvent; + /** + * Failed to schedule Bridge Tx. + **/ + BridgeTxScheduleFailed: AugmentedEvent; /** * Confirmation of a signer set change. **/ @@ -291,6 +287,14 @@ declare module '@polkadot/api/types/events' { * Exemption status of an identity has been updated. **/ ExemptedUpdated: AugmentedEvent; + /** + * A new freeze admin has been added. + **/ + FreezeAdminAdded: AugmentedEvent; + /** + * A freeze admin has been removed. + **/ + FreezeAdminRemoved: AugmentedEvent; /** * Notification of freezing the bridge. **/ @@ -510,9 +514,9 @@ declare module '@polkadot/api/types/events' { CAATransferred: AugmentedEvent; /** * A CA was initiated. - * (CAA DID, CA id, the CA) + * (CAA DID, CA id, the CA, the CA details) **/ - CAInitiated: AugmentedEvent; + CAInitiated: AugmentedEvent; /** * A CA was linked to a set of docs. * (CAA, CA Id, List of doc identifiers) @@ -1087,6 +1091,41 @@ declare module '@polkadot/api/types/events' { **/ FeeSet: AugmentedEvent; }; + relayer: { + /** + * Accepted paying key. + * + * (Caller DID, User Key, Paying Key) + **/ + AcceptedPayingKey: AugmentedEvent; + /** + * Authorization given for `paying_key` to `user_key`. + * + * (Caller DID, User Key, Paying Key, Initial POLYX limit, Auth ID) + **/ + AuthorizedPayingKey: AugmentedEvent; + /** + * Removed paying key. + * + * (Caller DID, User Key, Paying Key) + **/ + RemovedPayingKey: AugmentedEvent; + /** + * Updated polyx limit. + * + * (Caller DID, User Key, Paying Key, POLYX limit, old remaining POLYX) + **/ + UpdatedPolyxLimit: AugmentedEvent< + ApiType, + [EventDid, AccountId, AccountId, Balance, Balance] + >; + }; + rewards: { + /** + * Itn reward was claimed. + **/ + ItnRewardClaimed: AugmentedEvent; + }; scheduler: { /** * Canceled some task. \[when, index\] @@ -1169,6 +1208,10 @@ declare module '@polkadot/api/types/events' { * A new venue has been created (did, venue_id, details, type) **/ VenueCreated: AugmentedEvent; + /** + * An existing venue's details has been updated (did, venue_id, details) + **/ + VenueDetailsUpdated: AugmentedEvent; /** * Venue filtering has been enabled or disabled for a ticker (did, ticker, filtering_enabled) **/ @@ -1182,13 +1225,13 @@ declare module '@polkadot/api/types/events' { **/ VenuesBlocked: AugmentedEvent]>; /** - * Venue unauthorized by ticker owner (did, Ticker, venue_id) + * An existing venue's type has been updated (did, venue_id, type) **/ - VenueUnauthorized: AugmentedEvent; + VenueTypeUpdated: AugmentedEvent; /** - * An existing venue has been updated (did, venue_id, details, type) + * Venue unauthorized by ticker owner (did, Ticker, venue_id) **/ - VenueUpdated: AugmentedEvent; + VenueUnauthorized: AugmentedEvent; }; staking: { /** diff --git a/src/polkadot/augment-api-query.ts b/src/polkadot/augment-api-query.ts index 8723799ab4..ea8234ae1c 100644 --- a/src/polkadot/augment-api-query.ts +++ b/src/polkadot/augment-api-query.ts @@ -74,6 +74,7 @@ import type { AgentGroup, AssetCompliance, AssetIdentifier, + AssetName, AssetOwnershipRelation, Authorization, AuthorizationNonce, @@ -81,6 +82,7 @@ import type { BallotTimeRange, BallotVote, BridgeTxDetail, + CADetails, CAId, CheckpointId, Claim1stKey, @@ -88,13 +90,13 @@ import type { ClassicTickerRegistration, CorporateAction, Counter, + CustomAssetTypeId, DepositInfo, DidRecord, DispatchableName, Distribution, Document, DocumentId, - ExtVersion, ExtrinsicPermissions, FundingRoundName, Fundraiser, @@ -103,6 +105,7 @@ import type { IdentityId, InactiveMember, Instruction, + ItnRewardStatus, Leg, LegStatus, LocalCAId, @@ -125,11 +128,10 @@ import type { Signatory, SkippedCount, SlashingSwitch, - SmartExtension, - SmartExtensionType, SnapshotMetadata, SnapshottedPip, StoredSchedule, + Subsidy, TargetIdAuthorization, TargetIdentities, Tax, @@ -139,6 +141,7 @@ import type { TransferManager, TrustedIssuer, Venue, + VenueDetails, Version, VotingResult, } from 'polymesh-types/polymesh'; @@ -180,6 +183,15 @@ declare module '@polkadot/api/types/storage' { (arg: Ticker | string | Uint8Array) => Observable, [Ticker] >; + /** + * Asset name of the token corresponding to the token ticker. + * (ticker) -> `AssetName` + **/ + assetNames: AugmentedQuery< + ApiType, + (arg: Ticker | string | Uint8Array) => Observable, + [Ticker] + >; /** * Tickers and token owned by a user * (user, ticker) -> AssetOwnership @@ -226,58 +238,37 @@ declare module '@polkadot/api/types/storage' { [Ticker] >; /** - * Supported extension version. + * The next `AgentType::Custom` ID in the sequence. + * + * Numbers in the sequence start from 1 rather than 0. **/ - compatibleSmartExtVersion: AugmentedQuery< + customTypeIdSequence: AugmentedQuery Observable, []>; + /** + * Maps custom agent type ids to the registered string contents. + **/ + customTypes: AugmentedQuery< ApiType, - ( - arg: - | SmartExtensionType - | { TransferManager: any } - | { Offerings: any } - | { SmartWallet: any } - | { Custom: any } - | string - | Uint8Array - ) => Observable, - [SmartExtensionType] + (arg: CustomAssetTypeId | AnyNumber | Uint8Array) => Observable, + [CustomAssetTypeId] >; /** - * List of Smart extension added for the given tokens. - * ticker, AccountId (SE address) -> SmartExtension detail + * Inverse map of `CustomTypes`, from registered string contents to custom agent type ids. **/ - extensionDetails: AugmentedQuery< + customTypesInverse: AugmentedQuery< ApiType, - ( - arg: - | ITuple<[Ticker, AccountId]> - | [Ticker | string | Uint8Array, AccountId | string | Uint8Array] - ) => Observable, - [ITuple<[Ticker, AccountId]>] + (arg: Bytes | string | Uint8Array) => Observable, + [Bytes] >; /** - * List of Smart extension added for the given tokens and for the given type. - * ticker, type of SE -> address/AccountId of SE + * Decides whether investor uniqueness requirement is enforced for this asset. + * `false` means that it is enforced. + * + * Ticker => bool. **/ - extensions: AugmentedQuery< + disableInvestorUniqueness: AugmentedQuery< ApiType, - ( - arg: - | ITuple<[Ticker, SmartExtensionType]> - | [ - Ticker | string | Uint8Array, - ( - | SmartExtensionType - | { TransferManager: any } - | { Offerings: any } - | { SmartWallet: any } - | { Custom: any } - | string - | Uint8Array - ) - ] - ) => Observable>, - [ITuple<[Ticker, SmartExtensionType]>] + (arg: Ticker | string | Uint8Array) => Observable, + [Ticker] >; /** * The set of frozen assets implemented as a membership map. @@ -514,6 +505,14 @@ declare module '@polkadot/api/types/storage' { * transfers some POLY to their identity. **/ controller: AugmentedQuery Observable, []>; + /** + * Freeze bridge admins. These accounts can only freeze the bridge. + **/ + freezeAdmins: AugmentedQuery< + ApiType, + (arg: AccountId | string | Uint8Array) => Observable, + [AccountId] + >; /** * Whether or not the bridge operation is frozen. **/ @@ -816,6 +815,17 @@ declare module '@polkadot/api/types/storage' { (arg: Ticker | string | Uint8Array) => Observable, [Ticker] >; + /** + * Associates details in free-form text with a CA by its ID. + * (CAId => CADetails) + **/ + details: AugmentedQuery< + ApiType, + ( + arg: CAId | { ticker?: any; local_id?: any } | string | Uint8Array + ) => Observable, + [CAId] + >; /** * The amount of tax to withhold ("withholding tax", WT) for a certain ticker x DID. * If an entry exists for a certain DID, it overrides the default in `DefaultWithholdingTax`. @@ -1023,6 +1033,20 @@ declare module '@polkadot/api/types/storage' { state: AugmentedQuery Observable, []>; }; identity: { + /** + * How many "strong" references to the account key. + * + * Strong references will block a key from leaving it's identity. + * + * Pallets using "strong" references to account keys: + * * Relayer: For `user_key` and `paying_key` + * + **/ + accountKeyRefCount: AugmentedQuery< + ApiType, + (arg: AccountId | string | Uint8Array) => Observable, + [AccountId] + >; /** * All authorizations that an identity/key has **/ @@ -1391,7 +1415,7 @@ declare module '@polkadot/api/types/storage' { /** * The minimum amount to be used as a deposit for community PIP creation. **/ - minimumProposalDeposit: AugmentedQuery Observable, []>; + minimumProposalDeposit: AugmentedQuery Observable, []>; /** * How many blocks will it take, after a `Pending` PIP expires, * assuming it has not transitioned to another `ProposalState`? @@ -1524,6 +1548,18 @@ declare module '@polkadot/api/types/storage' { >; }; portfolio: { + /** + * Inverse map of `Portfolios` used to ensure bijectivitiy, + * and uniqueness of names in `Portfolios`. + **/ + nameToNumber: AugmentedQuery< + ApiType, + ( + arg1: IdentityId | string | Uint8Array, + arg2: PortfolioName | string + ) => Observable, + [IdentityId, PortfolioName] + >; /** * The next portfolio sequence number of an identity. **/ @@ -1543,6 +1579,14 @@ declare module '@polkadot/api/types/storage' { ) => Observable, [PortfolioId, Ticker] >; + /** + * How many assets with non-zero balance this portfolio contains. + **/ + portfolioAssetCount: AugmentedQuery< + ApiType, + (arg: PortfolioId | { did?: any; kind?: any } | string | Uint8Array) => Observable, + [PortfolioId] + >; /** * The custodian of a particular portfolio. None implies that the identity owner is the custodian. **/ @@ -1624,7 +1668,7 @@ declare module '@polkadot/api/types/storage' { | 'DistributionDistribute' | number | Uint8Array - ) => Observable, + ) => Observable, [ProtocolOp] >; /** @@ -1640,6 +1684,31 @@ declare module '@polkadot/api/types/storage' { **/ randomMaterial: AugmentedQuery Observable>, []>; }; + relayer: { + /** + * The subsidy for a `user_key` if they are being subsidised, + * as a map `user_key` => `Subsidy`. + * + * A key can only have one subsidy at a time. To change subsidisers + * a key needs to call `remove_paying_key` to remove the current subsidy, + * before they can accept a new subsidiser. + **/ + subsidies: AugmentedQuery< + ApiType, + (arg: AccountId | string | Uint8Array) => Observable>, + [AccountId] + >; + }; + rewards: { + /** + * Map of (Itn Address `AccountId`) -> (Reward `ItnRewardStatus`). + **/ + itnRewards: AugmentedQuery< + ApiType, + (arg: AccountId | string | Uint8Array) => Observable>, + [AccountId] + >; + }; scheduler: { /** * Items to be executed, indexed by the block number that they should be executed on. @@ -1722,6 +1791,15 @@ declare module '@polkadot/api/types/storage' { ) => Observable, [u64, PortfolioId] >; + /** + * Free-form text about a venue. venue_id -> `VenueDetails` + * Only needed for the UI. + **/ + details: AugmentedQuery< + ApiType, + (arg: u64 | AnyNumber | Uint8Array) => Observable, + [u64] + >; /** * Number of affirmations pending before instruction is executed. instruction_id -> affirm_pending **/ @@ -1821,13 +1899,27 @@ declare module '@polkadot/api/types/storage' { [Ticker] >; /** - * Info about a venue. venue_id -> venue_details + * Info about a venue. venue_id -> venue **/ venueInfo: AugmentedQuery< ApiType, (arg: u64 | AnyNumber | Uint8Array) => Observable>, [u64] >; + /** + * Instructions under a venue. + * Only needed for the UI. + * + * venue_id -> instruction_id -> () + **/ + venueInstructions: AugmentedQuery< + ApiType, + ( + arg1: u64 | AnyNumber | Uint8Array, + arg2: u64 | AnyNumber | Uint8Array + ) => Observable>, + [u64, u64] + >; /** * Signers allowed by the venue. (venue_id, signer) -> bool **/ diff --git a/src/polkadot/augment-api-tx.ts b/src/polkadot/augment-api-tx.ts index b4dd73d9fe..abb950cd07 100644 --- a/src/polkadot/augment-api-tx.ts +++ b/src/polkadot/augment-api-tx.ts @@ -66,6 +66,7 @@ import type { IdentityId, InvestorUid, InvestorZKProofData, + ItnRewardStatus, Leg, LegacyPermissions, MaybeBlock, @@ -135,7 +136,7 @@ declare module '@polkadot/api/types/submittable' { * * `auth_id` Authorization ID of ticker transfer authorization. * * ## Errors - * - `NoTickerTransferAuth` if `auth_id` is not a valid ticket transfer authorization. + * - `AuthorizationError::BadType` if `auth_id` is not a valid ticket transfer authorization. * **/ acceptTickerTransfer: AugmentedSubmittable< @@ -220,6 +221,8 @@ declare module '@polkadot/api/types/submittable' { * * `asset_type` - the asset type. * * `identifiers` - a vector of asset identifiers. * * `funding_round` - name of the funding round. + * * `disable_iu` - whether or not investor uniqueness enforcement should be disabled. + * This cannot be changed after creating the asset. * * ## Errors * - `InvalidAssetIdentifier` if any of `identifiers` are invalid. @@ -265,9 +268,10 @@ declare module '@polkadot/api/types/submittable' { | string | Uint8Array )[], - fundingRound: Option | null | object | string | Uint8Array + fundingRound: Option | null | object | string | Uint8Array, + disableIu: bool | boolean | Uint8Array ) => SubmittableExtrinsic, - [AssetName, Ticker, bool, AssetType, Vec, Option] + [AssetName, Ticker, bool, AssetType, Vec, Option, bool] >; /** * Freezes transfers and minting of a given token. @@ -287,13 +291,13 @@ declare module '@polkadot/api/types/submittable' { [Ticker] >; /** - * Function is used to issue(or mint) new tokens to the primary issuance agent. - * It can be executed by the token owner or the PIA. + * Issue, or mint, new tokens to the caller, + * which must be an authorized agent, e.g., a primary issuance agent. * * # Arguments - * * `origin` Secondary key of token owner. - * * `ticker` Ticker of the token. - * * `value` Amount of tokens that get issued. + * * `origin` must be the secondary key of token owner. + * * `ticker` of the token. + * * `amount` of tokens that get issued. * * # Permissions * * Asset @@ -302,7 +306,7 @@ declare module '@polkadot/api/types/submittable' { issue: AugmentedSubmittable< ( ticker: Ticker | string | Uint8Array, - value: Balance | AnyNumber | Uint8Array + amount: Balance | AnyNumber | Uint8Array ) => SubmittableExtrinsic, [Ticker, Balance] >; @@ -347,6 +351,21 @@ declare module '@polkadot/api/types/submittable' { ) => SubmittableExtrinsic, [Ticker, Balance] >; + /** + * Registers a custom asset type. + * + * The provided `ty` will be bound to an ID in storage. + * The ID can then be used in `AssetType::Custom`. + * Should the `ty` already exist in storage, no second ID is assigned to it. + * + * # Arguments + * * `origin` who called the extrinsic. + * * `ty` contains the string representation of the asset type. + **/ + registerCustomAssetType: AugmentedSubmittable< + (ty: Bytes | string | Uint8Array) => SubmittableExtrinsic, + [Bytes] + >; /** * Registers a new ticker or extends validity of an existing ticker. * NB: Ticker validity does not get carry forward when renewing ticker. @@ -716,13 +735,23 @@ declare module '@polkadot/api/types/submittable' { >; }; bridge: { + /** + * Add a freeze admin. + * + * ## Errors + * - `BadAdmin` if `origin` is not `Self::admin()` account. + **/ + addFreezeAdmin: AugmentedSubmittable< + (freezeAdmin: AccountId | string | Uint8Array) => SubmittableExtrinsic, + [AccountId] + >; /** * Proposes a vector of bridge transactions. The vector is processed until the first * proposal which causes an error, in which case the error is returned and the rest of * proposals are not processed. * * ## Errors - * - `ControllerNotSet` if `Controlles` was not set. + * - `ControllerNotSet` if `Controllers` was not set. * * # Weight * `500_000_000 + 7_000_000 * bridge_txs.len()` @@ -769,6 +798,7 @@ declare module '@polkadot/api/types/submittable' { * * ## Errors * - `BadAdmin` if `origin` is not `Self::admin()` account. + * - `DivisionByZero` if `duration` is zero. **/ changeBridgeLimit: AugmentedSubmittable< ( @@ -887,7 +917,7 @@ declare module '@polkadot/api/types/submittable' { * transaction has already been proposed. * * ## Errors - * - `ControllerNotSet` if `Controlles` was not set. + * - `ControllerNotSet` if `Controllers` was not set. **/ proposeBridgeTx: AugmentedSubmittable< ( @@ -899,6 +929,16 @@ declare module '@polkadot/api/types/submittable' { ) => SubmittableExtrinsic, [BridgeTx] >; + /** + * Remove a freeze admin. + * + * ## Errors + * - `BadAdmin` if `origin` is not `Self::admin()` account. + **/ + removeFreezeAdmin: AugmentedSubmittable< + (freezeAdmin: AccountId | string | Uint8Array) => SubmittableExtrinsic, + [AccountId] + >; /** * Unfreezes transaction handling in the bridge module if it is frozen. * @@ -1047,7 +1087,6 @@ declare module '@polkadot/api/types/submittable' { * * # Errors * - `NoSuchDistribution` if there's no capital distribution for `ca_id`. - * - `NotDistributionCreator` if `origin` is not the original creator of the distribution. * - `AlreadyReclaimed` if this function has already been called successfully. * - `NotExpired` if `now < expiry`. **/ @@ -1945,6 +1984,28 @@ declare module '@polkadot/api/types/submittable' { (ticker: Ticker | string | Uint8Array) => SubmittableExtrinsic, [Ticker] >; + /** + * Accept an authorization by an agent "Alice" who issued `auth_id` + * to also become an agent of the ticker Alice specified. + * + * # Arguments + * - `auth_id` identifying the authorization to accept. + * + * # Errors + * - `AuthorizationError::Invalid` if `auth_id` does not exist for the given caller. + * - `AuthorizationError::Expired` if `auth_id` is for an auth that has expired. + * - `AuthorizationError::BadType` if `auth_id` was not for a `BecomeAgent` auth type. + * - `UnauthorizedAgent` if "Alice" is not permissioned to provide the auth. + * - `NoSuchAG` if the group referred to a custom that does not exist. + * - `AlreadyAnAgent` if the caller is already an agent of the ticker. + * + * # Permissions + * * Agent + **/ + acceptBecomeAgent: AugmentedSubmittable< + (authId: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, + [u64] + >; /** * Change the agent group that `agent` belongs to in `ticker`. * @@ -2133,17 +2194,6 @@ declare module '@polkadot/api/types/submittable' { >; }; identity: { - /** - * Accepts an authorization. - * - * Does not check extrinsic permission checks for the caller in order to allow it to be an - * account without an identity. - * NB: The current weight is a defensive approximation. - **/ - acceptAuthorization: AugmentedSubmittable< - (authId: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, - [u64] - >; /** * Call this with the new primary key. By invoking this method, caller accepts authorization * with the new primary key. If a CDD service provider approved this change, primary key of @@ -2933,7 +2983,7 @@ declare module '@polkadot/api/types/submittable' { * multisig. * * # Arguments - * * `multi_sig` - multi sig address + * * `multisig` - multi sig address **/ makeMultisigSigner: AugmentedSubmittable< (multisig: AccountId | string | Uint8Array) => SubmittableExtrinsic, @@ -3084,11 +3134,11 @@ declare module '@polkadot/api/types/submittable' { propose: AugmentedSubmittable< ( proposal: Proposal | { callIndex?: any; args?: any } | string | Uint8Array, - deposit: BalanceOf | AnyNumber | Uint8Array, + deposit: Balance | AnyNumber | Uint8Array, url: Option | null | object | string | Uint8Array, description: Option | null | object | string | Uint8Array ) => SubmittableExtrinsic, - [Proposal, BalanceOf, Option, Option] + [Proposal, Balance, Option, Option] >; /** * Prune the PIP given by the `id`, refunding any funds not already refunded. @@ -3178,8 +3228,8 @@ declare module '@polkadot/api/types/submittable' { * * `deposit` the new min deposit required to start a proposal **/ setMinProposalDeposit: AugmentedSubmittable< - (deposit: BalanceOf | AnyNumber | Uint8Array) => SubmittableExtrinsic, - [BalanceOf] + (deposit: Balance | AnyNumber | Uint8Array) => SubmittableExtrinsic, + [Balance] >; /** * Change the amount of blocks after which a pending PIP is expired. @@ -3238,9 +3288,9 @@ declare module '@polkadot/api/types/submittable' { ( id: PipId | AnyNumber | Uint8Array, ayeOrNay: bool | boolean | Uint8Array, - deposit: BalanceOf | AnyNumber | Uint8Array + deposit: Balance | AnyNumber | Uint8Array ) => SubmittableExtrinsic, - [PipId, bool, BalanceOf] + [PipId, bool, Balance] >; }; polymeshCommittee: { @@ -3332,6 +3382,10 @@ declare module '@polkadot/api/types/submittable' { >; }; portfolio: { + acceptPortfolioCustody: AugmentedSubmittable< + (authId: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, + [u64] + >; /** * Creates a portfolio with the given `name`. **/ @@ -3397,7 +3451,7 @@ declare module '@polkadot/api/types/submittable' { **/ quitPortfolioCustody: AugmentedSubmittable< ( - portfolioId: PortfolioId | { did?: any; kind?: any } | string | Uint8Array + pid: PortfolioId | { did?: any; kind?: any } | string | Uint8Array ) => SubmittableExtrinsic, [PortfolioId] >; @@ -3448,9 +3502,9 @@ declare module '@polkadot/api/types/submittable' { | 'DistributionDistribute' | number | Uint8Array, - baseFee: BalanceOf | AnyNumber | Uint8Array + baseFee: Balance | AnyNumber | Uint8Array ) => SubmittableExtrinsic, - [ProtocolOp, BalanceOf] + [ProtocolOp, Balance] >; /** * Changes the fee coefficient for the root origin. @@ -3463,6 +3517,162 @@ declare module '@polkadot/api/types/submittable' { [PosRatio] >; }; + relayer: { + /** + * Accepts a `paying_key` authorization. + * + * # Arguments + * - `auth_id` the authorization id to accept a `paying_key`. + * + * # Errors + * - `AuthorizationError::Invalid` if `auth_id` does not exist for the given caller. + * - `AuthorizationError::Expired` if `auth_id` the authorization has expired. + * - `AuthorizationError::BadType` if `auth_id` was not a `AddRelayerPayingKey` authorization. + * - `NotAuthorizedForUserKey` if `origin` is not authorized to accept the authorization for the `user_key`. + * - `NotAuthorizedForPayingKey` if the authorization was created by a signer that isn't authorized by the `paying_key`. + * - `UserKeyCddMissing` if the `user_key` is not attached to a CDD'd identity. + * - `PayingKeyCddMissing` if the `paying_key` is not attached to a CDD'd identity. + * - `UnauthorizedCaller` if `origin` is not authorized to call this extrinsic. + **/ + acceptPayingKey: AugmentedSubmittable< + (authId: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, + [u64] + >; + /** + * Decrease the available POLYX for a `user_key`. + * + * # Arguments + * - `user_key` the user key of the subsidy to update the available POLYX. + * - `amount` the amount of POLYX to remove from the subsidy of `user_key`. + * + * # Errors + * - `NoPayingKey` if the `user_key` doesn't have a `paying_key`. + * - `NotPayingKey` if `origin` doesn't match the current `paying_key`. + * - `UnauthorizedCaller` if `origin` is not authorized to call this extrinsic. + * - `Overlow` if the subsidy has less then `amount` POLYX remaining. + **/ + decreasePolyxLimit: AugmentedSubmittable< + ( + userKey: AccountId | string | Uint8Array, + amount: Balance | AnyNumber | Uint8Array + ) => SubmittableExtrinsic, + [AccountId, Balance] + >; + /** + * Increase the available POLYX for a `user_key`. + * + * # Arguments + * - `user_key` the user key of the subsidy to update the available POLYX. + * - `amount` the amount of POLYX to add to the subsidy of `user_key`. + * + * # Errors + * - `NoPayingKey` if the `user_key` doesn't have a `paying_key`. + * - `NotPayingKey` if `origin` doesn't match the current `paying_key`. + * - `UnauthorizedCaller` if `origin` is not authorized to call this extrinsic. + * - `Overlow` if the subsidy's remaining POLYX would have overflowed `u128::MAX`. + **/ + increasePolyxLimit: AugmentedSubmittable< + ( + userKey: AccountId | string | Uint8Array, + amount: Balance | AnyNumber | Uint8Array + ) => SubmittableExtrinsic, + [AccountId, Balance] + >; + /** + * Removes the `paying_key` from a `user_key`. + * + * # Arguments + * - `user_key` the user key to remove the subsidy from. + * - `paying_key` the paying key that was subsidising the `user_key`. + * + * # Errors + * - `NotAuthorizedForUserKey` if `origin` is not authorized to remove the subsidy for the `user_key`. + * - `NoPayingKey` if the `user_key` doesn't have a `paying_key`. + * - `NotPayingKey` if the `paying_key` doesn't match the current `paying_key`. + * - `UnauthorizedCaller` if `origin` is not authorized to call this extrinsic. + **/ + removePayingKey: AugmentedSubmittable< + ( + userKey: AccountId | string | Uint8Array, + payingKey: AccountId | string | Uint8Array + ) => SubmittableExtrinsic, + [AccountId, AccountId] + >; + /** + * Creates an authorization to allow `user_key` to accept the caller (`origin == paying_key`) as their subsidiser. + * + * # Arguments + * - `user_key` the user key to subsidise. + * - `polyx_limit` the initial POLYX limit for this subsidy. + * + * # Errors + * - `UnauthorizedCaller` if `origin` is not authorized to call this extrinsic. + **/ + setPayingKey: AugmentedSubmittable< + ( + userKey: AccountId | string | Uint8Array, + polyxLimit: Balance | AnyNumber | Uint8Array + ) => SubmittableExtrinsic, + [AccountId, Balance] + >; + /** + * Updates the available POLYX for a `user_key`. + * + * # Arguments + * - `user_key` the user key of the subsidy to update the available POLYX. + * - `polyx_limit` the amount of POLYX available for subsidising the `user_key`. + * + * # Errors + * - `NoPayingKey` if the `user_key` doesn't have a `paying_key`. + * - `NotPayingKey` if `origin` doesn't match the current `paying_key`. + * - `UnauthorizedCaller` if `origin` is not authorized to call this extrinsic. + **/ + updatePolyxLimit: AugmentedSubmittable< + ( + userKey: AccountId | string | Uint8Array, + polyxLimit: Balance | AnyNumber | Uint8Array + ) => SubmittableExtrinsic, + [AccountId, Balance] + >; + }; + rewards: { + /** + * Claim an ITN reward. + * + * ## Arguments + * * `itn_address` specifying the awarded address on ITN. + * * `signature` authenticating the claim to the reward. + * The signature should contain `reward_address` followed by the suffix `"claim_itn_reward"`, + * and must have been signed by `itn_address`. + * + * # Errors + * * `InsufficientBalance` - Itn rewards has insufficient funds to issue the reward. + * * `InvalidSignature` - `signature` had an invalid signer or invalid message. + * * `ItnRewardAlreadyClaimed` - Reward issued to the `itn_address` has already been claimed. + * * `UnknownItnAddress` - `itn_address` is not in the rewards table and has no reward to be claimed. + **/ + claimItnReward: AugmentedSubmittable< + ( + rewardAddress: AccountId | string | Uint8Array, + itnAddress: AccountId | string | Uint8Array, + signature: + | OffChainSignature + | { Ed25519: any } + | { Sr25519: any } + | { Ecdsa: any } + | string + | Uint8Array + ) => SubmittableExtrinsic, + [AccountId, AccountId, OffChainSignature] + >; + setItnRewardStatus: AugmentedSubmittable< + ( + itnAddress: AccountId | string | Uint8Array, + status: ItnRewardStatus | { Unclaimed: any } | { Claimed: any } | string | Uint8Array + ) => SubmittableExtrinsic, + [AccountId, ItnRewardStatus] + >; + }; scheduler: { /** * Cancel an anonymously scheduled task. @@ -3795,13 +4005,13 @@ declare module '@polkadot/api/types/submittable' { * * * `details` - Extra details about a venue * * `signers` - Array of signers that are allowed to sign receipts for this venue - * * `venue_type` - Type of venue being created + * * `typ` - Type of venue being created **/ createVenue: AugmentedSubmittable< ( details: VenueDetails | string, signers: Vec | (AccountId | string | Uint8Array)[], - venueType: VenueType | 'Other' | 'Distribution' | 'Sto' | 'Exchange' | number | Uint8Array + typ: VenueType | 'Other' | 'Distribution' | 'Sto' | 'Exchange' | number | Uint8Array ) => SubmittableExtrinsic, [VenueDetails, Vec, VenueType] >; @@ -3892,20 +4102,30 @@ declare module '@polkadot/api/types/submittable' { [u64, u64] >; /** - * Edit venue details and types. - * Both parameters are optional, they will be updated only if Some(value) is provided + * Edit a venue's details. * - * * `venue_id` - ID of the venue to edit - * * `details` - Extra details about a venue - * * `type` - Type of venue being created + * * `id` specifies the ID of the venue to edit. + * * `details` specifies the updated venue details. **/ - updateVenue: AugmentedSubmittable< + updateVenueDetails: AugmentedSubmittable< ( - venueId: u64 | AnyNumber | Uint8Array, - details: Option | null | object | string | Uint8Array, - typ: Option | null | object | string | Uint8Array + id: u64 | AnyNumber | Uint8Array, + details: VenueDetails | string + ) => SubmittableExtrinsic, + [u64, VenueDetails] + >; + /** + * Edit a venue's type. + * + * * `id` specifies the ID of the venue to edit. + * * `type` specifies the new type of the venue. + **/ + updateVenueType: AugmentedSubmittable< + ( + id: u64 | AnyNumber | Uint8Array, + typ: VenueType | 'Other' | 'Distribution' | 'Sto' | 'Exchange' | number | Uint8Array ) => SubmittableExtrinsic, - [u64, Option, Option] + [u64, VenueType] >; /** * Withdraw an affirmation for a given instruction. diff --git a/src/polkadot/augment-types.ts b/src/polkadot/augment-types.ts index bd22c8132b..dcc553485b 100644 --- a/src/polkadot/augment-types.ts +++ b/src/polkadot/augment-types.ts @@ -961,6 +961,7 @@ import type { CorporateAction, Counter, CountryCode, + CustomAssetTypeId, DepositInfo, DidRecord, DidRecords, @@ -999,6 +1000,7 @@ import type { InvestorUid, InvestorZKProofData, IssueRecipient, + ItnRewardStatus, KeyIdentityData, Leg, LegStatus, @@ -1133,6 +1135,7 @@ declare module '@polkadot/types/types/registry' { 'Compact': Compact; 'Compact': Compact; 'Compact': Compact; + 'Compact': Compact; 'Compact': Compact; 'Compact': Compact; 'Compact': Compact; @@ -1445,6 +1448,7 @@ declare module '@polkadot/types/types/registry' { 'Option': Option; 'Option': Option; 'Option': Option; + 'Option': Option; 'Option': Option; 'Option': Option; 'Option': Option; @@ -1686,6 +1690,7 @@ declare module '@polkadot/types/types/registry' { 'Option': Option; 'Option': Option; 'Option': Option; + 'Option': Option; 'Option': Option; 'Option': Option; 'Option': Option; @@ -2479,6 +2484,7 @@ declare module '@polkadot/types/types/registry' { 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; + 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; @@ -2720,6 +2726,7 @@ declare module '@polkadot/types/types/registry' { 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; + 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; @@ -3513,6 +3520,7 @@ declare module '@polkadot/types/types/registry' { Counter: Counter; CountryCode: CountryCode; CreatedBlock: CreatedBlock; + CustomAssetTypeId: CustomAssetTypeId; Data: Data; DeferredOffenceOf: DeferredOffenceOf; DefunctVoter: DefunctVoter; @@ -3754,6 +3762,7 @@ declare module '@polkadot/types/types/registry' { InvestorUid: InvestorUid; InvestorZKProofData: InvestorZKProofData; IssueRecipient: IssueRecipient; + ItnRewardStatus: ItnRewardStatus; Json: Json; Junction: Junction; Justification: Justification; diff --git a/src/polkadot/definitions.ts b/src/polkadot/definitions.ts index b0923b8fa9..03a77fddd4 100644 --- a/src/polkadot/definitions.ts +++ b/src/polkadot/definitions.ts @@ -1,5 +1,3 @@ -/* istanbul ignore file */ - export { default as polymesh } from './polymesh/definitions'; export { default as compliance } from './compliance/definitions'; export { default as identity } from './identity/definitions'; diff --git a/src/polkadot/polymesh/definitions.ts b/src/polkadot/polymesh/definitions.ts index 5cf2734c4d..ba80a3d683 100644 --- a/src/polkadot/polymesh/definitions.ts +++ b/src/polkadot/polymesh/definitions.ts @@ -42,6 +42,7 @@ export default { filing_date: 'Option', }, Version: 'u8', + CustomAssetTypeId: 'u32', AssetType: { _enum: { EquityCommon: '', @@ -53,7 +54,7 @@ export default { RevenueShareAgreement: '', StructuredProduct: '', Derivative: '', - Custom: 'Vec', + Custom: 'CustomAssetTypeId', StableCoin: '', }, }, @@ -76,7 +77,6 @@ export default { FundingRoundName: 'Text', VenueDetails: 'Text', SecurityToken: { - name: 'AssetName', total_supply: 'Balance', owner_did: 'IdentityId', divisible: 'bool', @@ -1007,8 +1007,6 @@ export default { }, Venue: { creator: 'IdentityId', - instructions: 'Vec', - details: 'VenueDetails', venue_type: 'VenueType', }, Receipt: { @@ -1120,7 +1118,6 @@ export default { kind: 'CAKind', decl_date: 'Moment', record_date: 'Option', - details: 'Text', targets: 'TargetIdentities', default_withholding_tax: 'Tax', withholding_tax: 'Vec<(IdentityId, Tax)>', @@ -1198,5 +1195,11 @@ export default { PolymeshV1PIA: '', }, }, + ItnRewardStatus: { + _enum: { + Unclaimed: 'Balance', + Claimed: '', + }, + }, }, }; diff --git a/src/polkadot/polymesh/types.ts b/src/polkadot/polymesh/types.ts index f6ad35f8ff..e7f293b9db 100644 --- a/src/polkadot/polymesh/types.ts +++ b/src/polkadot/polymesh/types.ts @@ -129,7 +129,7 @@ export interface AssetType extends Enum { readonly isStructuredProduct: boolean; readonly isDerivative: boolean; readonly isCustom: boolean; - readonly asCustom: Bytes; + readonly asCustom: CustomAssetTypeId; readonly isStableCoin: boolean; } @@ -450,7 +450,6 @@ export interface CorporateAction extends Struct { readonly kind: CAKind; readonly decl_date: Moment; readonly record_date: Option; - readonly details: Text; readonly targets: TargetIdentities; readonly default_withholding_tax: Tax; readonly withholding_tax: Vec>; @@ -713,6 +712,9 @@ export interface CountryCode extends Enum { readonly isSx: boolean; } +/** @name CustomAssetTypeId */ +export interface CustomAssetTypeId extends u32 {} + /** @name DepositInfo */ export interface DepositInfo extends Struct { readonly owner: AccountId; @@ -979,6 +981,13 @@ export interface IssueRecipient extends Enum { readonly asIdentity: IdentityId; } +/** @name ItnRewardStatus */ +export interface ItnRewardStatus extends Enum { + readonly isUnclaimed: boolean; + readonly asUnclaimed: Balance; + readonly isClaimed: boolean; +} + /** @name KeyIdentityData */ export interface KeyIdentityData extends Struct { readonly identity: IdentityId; @@ -1375,7 +1384,6 @@ export interface SecondaryKeyWithAuth extends Struct { /** @name SecurityToken */ export interface SecurityToken extends Struct { - readonly name: AssetName; readonly total_supply: Balance; readonly owner_did: IdentityId; readonly divisible: bool; @@ -1589,8 +1597,6 @@ export interface ValidatorPrefsWithBlocked extends Struct { /** @name Venue */ export interface Venue extends Struct { readonly creator: IdentityId; - readonly instructions: Vec; - readonly details: VenueDetails; readonly venue_type: VenueType; } diff --git a/src/polkadot/schema.ts b/src/polkadot/schema.ts index ff15a4c00c..6f51385ac1 100644 --- a/src/polkadot/schema.ts +++ b/src/polkadot/schema.ts @@ -4,6 +4,9 @@ export default { Address: 'MultiAddress', LookupSource: 'MultiAddress', AccountInfo: 'AccountInfoWithDualRefCount', + ValidatorPrefsWithBlocked: { + commission: 'Compact', + }, IdentityId: '[u8; 32]', EventDid: 'IdentityId', EventCounts: 'Vec', @@ -38,6 +41,7 @@ export default { filing_date: 'Option', }, Version: 'u8', + CustomAssetTypeId: 'u32', AssetType: { _enum: { EquityCommon: '', @@ -49,7 +53,7 @@ export default { RevenueShareAgreement: '', StructuredProduct: '', Derivative: '', - Custom: 'Vec', + Custom: 'CustomAssetTypeId', StableCoin: '', }, }, @@ -72,7 +76,6 @@ export default { FundingRoundName: 'Text', VenueDetails: 'Text', SecurityToken: { - name: 'AssetName', total_supply: 'Balance', owner_did: 'IdentityId', divisible: 'bool', @@ -1003,8 +1006,6 @@ export default { }, Venue: { creator: 'IdentityId', - instructions: 'Vec', - details: 'VenueDetails', venue_type: 'VenueType', }, Receipt: { @@ -1116,7 +1117,6 @@ export default { kind: 'CAKind', decl_date: 'Moment', record_date: 'Option', - details: 'Text', targets: 'TargetIdentities', default_withholding_tax: 'Tax', withholding_tax: 'Vec<(IdentityId, Tax)>', @@ -1194,6 +1194,12 @@ export default { PolymeshV1PIA: '', }, }, + ItnRewardStatus: { + _enum: { + Unclaimed: 'Balance', + Claimed: '', + }, + }, }, rpc: { compliance: { diff --git a/src/polkadot/types.ts b/src/polkadot/types.ts index 5b6119ec9d..09dac29cca 100644 --- a/src/polkadot/types.ts +++ b/src/polkadot/types.ts @@ -291,6 +291,7 @@ export enum AssetTx { AddDocuments = 'asset.addDocuments', RemoveDocuments = 'asset.removeDocuments', ReserveClassicTicker = 'asset.reserveClassicTicker', + RegisterCustomAssetType = 'asset.registerCustomAssetType', } export enum DividendTx { @@ -365,6 +366,8 @@ export enum BridgeTx { FreezeTxs = 'bridge.freezeTxs', UnfreezeTxs = 'bridge.unfreezeTxs', HandleScheduledBridgeTx = 'bridge.handleScheduledBridgeTx', + AddFreezeAdmin = 'bridge.addFreezeAdmin', + RemoveFreezeAdmin = 'bridge.removeFreezeAdmin', } export enum ComplianceManagerTx { @@ -428,6 +431,8 @@ export enum SettlementTx { ExecuteScheduledInstruction = 'settlement.executeScheduledInstruction', ChangeReceiptValidity = 'settlement.changeReceiptValidity', RescheduleInstruction = 'settlement.rescheduleInstruction', + UpdateVenueDetails = 'settlement.updateVenueDetails', + UpdateVenueType = 'settlement.updateVenueType', } export enum StoTx { @@ -468,6 +473,7 @@ export enum PortfolioTx { MovePortfolioFunds = 'portfolio.movePortfolioFunds', RenamePortfolio = 'portfolio.renamePortfolio', QuitPortfolioCustody = 'portfolio.quitPortfolioCustody', + AcceptPortfolioCustody = 'portfolio.acceptPortfolioCustody', } export enum ConfidentialTx { @@ -540,6 +546,21 @@ export enum ExternalAgentsTx { RemoveAgent = 'externalAgents.removeAgent', Abdicate = 'externalAgents.abdicate', ChangeGroup = 'externalAgents.changeGroup', + AcceptBecomeAgent = 'externalAgents.acceptBecomeAgent', +} + +export enum RelayerTx { + SetPayingKey = 'relayer.setPayingKey', + AcceptPayingKey = 'relayer.acceptPayingKey', + RemovePayingKey = 'relayer.removePayingKey', + UpdatePolyxLimit = 'relayer.updatePolyxLimit', + IncreasePolyxLimit = 'relayer.increasePolyxLimit', + DecreasePolyxLimit = 'relayer.decreasePolyxLimit', +} + +export enum RewardsTx { + ClaimItnReward = 'rewards.claimItnReward', + SetItnRewardStatus = 'rewards.setItnRewardStatus', } export enum ModuleName { @@ -588,6 +609,8 @@ export enum ModuleName { Statistics = 'statistics', TestUtils = 'testUtils', ExternalAgents = 'externalAgents', + Relayer = 'relayer', + Rewards = 'rewards', } export type TxTag = @@ -635,7 +658,9 @@ export type TxTag = | CheckpointTx | StatisticsTx | TestUtilsTx - | ExternalAgentsTx; + | ExternalAgentsTx + | RelayerTx + | RewardsTx; export const TxTags = { system: SystemTx, @@ -683,4 +708,6 @@ export const TxTags = { statistics: StatisticsTx, testUtils: TestUtilsTx, externalAgents: ExternalAgentsTx, + relayer: RelayerTx, + rewards: RewardsTx, }; diff --git a/src/testUtils/mocks/dataSources.ts b/src/testUtils/mocks/dataSources.ts index 233441c4a6..18a3924768 100644 --- a/src/testUtils/mocks/dataSources.ts +++ b/src/testUtils/mocks/dataSources.ts @@ -3109,7 +3109,6 @@ export const createMockCorporateAction = (corporateAction?: { kind: CAKind | Parameters[0]; decl_date: Moment | Parameters[0]; record_date: Option | Parameters[0]; - details: Text | Parameters[0]; targets: TargetIdentities | Parameters[0]; default_withholding_tax: Tax | Parameters[0]; withholding_tax: [ @@ -3121,7 +3120,6 @@ export const createMockCorporateAction = (corporateAction?: { kind, decl_date, record_date, - details, targets, default_withholding_tax, withholding_tax, @@ -3129,7 +3127,6 @@ export const createMockCorporateAction = (corporateAction?: { kind: createMockCAKind(), decl_date: createMockMoment(), record_date: createMockOption(), - details: createMockText(), targets: createMockTargetIdentities(), default_withholding_tax: createMockPermill(), withholding_tax: [], @@ -3140,7 +3137,6 @@ export const createMockCorporateAction = (corporateAction?: { kind: createMockCAKind(kind), decl_date: createMockMoment(decl_date), record_date: createMockOption(record_date), - details: createMockText(details), targets: createMockTargetIdentities(targets), default_withholding_tax: createMockPermill(default_withholding_tax), withholding_tax: withholding_tax.map(([identityId, tax]) => diff --git a/src/types/index.ts b/src/types/index.ts index 318c53952e..d9cb84be51 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -226,21 +226,34 @@ export interface TokenDocument { } /** - * Type of authorization request + * Type of Authorization Request */ export enum AuthorizationType { + /** + * @deprecated + */ + NoData = 'NoData', + /** + * @deprecated + */ + Custom = 'Custom', + /** + * @deprecated + */ + TransferPrimaryIssuanceAgent = 'TransferPrimaryIssuanceAgent', + /** + * @deprecated + */ + TransferCorporateActionAgent = 'TransferCorporateActionAgent', AttestPrimaryKeyRotation = 'AttestPrimaryKeyRotation', RotatePrimaryKey = 'RotatePrimaryKey', TransferTicker = 'TransferTicker', AddMultiSigSigner = 'AddMultiSigSigner', TransferAssetOwnership = 'TransferAssetOwnership', - TransferPrimaryIssuanceAgent = 'TransferPrimaryIssuanceAgent', JoinIdentity = 'JoinIdentity', PortfolioCustody = 'PortfolioCustody', - TransferCorporateActionAgent = 'TransferCorporateActionAgent', BecomeAgent = 'BecomeAgent', - Custom = 'Custom', - NoData = 'NoData', + AddRelayerPayingKey = 'AddRelayerPayingKey', } export enum ConditionTarget { @@ -813,6 +826,21 @@ export enum KnownPermissionGroup { */ export type PermissionGroup = KnownPermissionGroup | { custom: BigNumber }; +export interface RelayerRelationship { + /** + * Account whose transactions are being paid for + */ + beneficiary: Account; + /** + * Account that is paying for the transactions + */ + relayer: Account; + /** + * total initial amount of POLYX to be subsidized. This can be "refilled" later on + */ + allowanceLimit: BigNumber; +} + /** * Authorization request data corresponding to type */ @@ -821,10 +849,10 @@ export type Authorization = | { type: AuthorizationType.JoinIdentity; value: Permissions } | { type: AuthorizationType.PortfolioCustody; value: NumberedPortfolio | DefaultPortfolio } | { type: AuthorizationType.BecomeAgent; value: string; permissionGroup: PermissionGroup } + | { type: AuthorizationType.AddRelayerPayingKey; value: RelayerRelationship } | { type: Exclude< AuthorizationType, - | AuthorizationType.NoData | AuthorizationType.JoinIdentity | AuthorizationType.PortfolioCustody | AuthorizationType.BecomeAgent diff --git a/src/utils/__tests__/conversion.ts b/src/utils/__tests__/conversion.ts index 2bee6a801b..03a224b137 100644 --- a/src/utils/__tests__/conversion.ts +++ b/src/utils/__tests__/conversion.ts @@ -5807,8 +5807,8 @@ describe('meshCorporateActionToCorporateActionParams', () => { const fakeResult: CorporateActionParams = { kind, declarationDate, - description, targets, + description, defaultTaxWithholding, taxWithholdings, }; @@ -5817,7 +5817,6 @@ describe('meshCorporateActionToCorporateActionParams', () => { kind, decl_date: declarationDate.getTime(), record_date: null, - details: description, targets: { identities: dids, treatment: TargetTreatment.Include, @@ -5827,8 +5826,9 @@ describe('meshCorporateActionToCorporateActionParams', () => { }; let corporateAction = dsMockUtils.createMockCorporateAction(params); + const details = dsMockUtils.createMockText(description); - let result = meshCorporateActionToCorporateActionParams(corporateAction, context); + let result = meshCorporateActionToCorporateActionParams(corporateAction, details, context); expect(result).toEqual(fakeResult); @@ -5841,7 +5841,7 @@ describe('meshCorporateActionToCorporateActionParams', () => { kind: dsMockUtils.createMockCAKind('IssuerNotice'), }); - result = meshCorporateActionToCorporateActionParams(corporateAction, context); + result = meshCorporateActionToCorporateActionParams(corporateAction, details, context); expect(result).toEqual({ ...fakeResult, @@ -5854,7 +5854,7 @@ describe('meshCorporateActionToCorporateActionParams', () => { kind: dsMockUtils.createMockCAKind('PredictableBenefit'), }); - result = meshCorporateActionToCorporateActionParams(corporateAction, context); + result = meshCorporateActionToCorporateActionParams(corporateAction, details, context); expect(result).toEqual({ ...fakeResult, kind: CorporateActionKind.PredictableBenefit }); @@ -5863,7 +5863,7 @@ describe('meshCorporateActionToCorporateActionParams', () => { kind: dsMockUtils.createMockCAKind('Other'), }); - result = meshCorporateActionToCorporateActionParams(corporateAction, context); + result = meshCorporateActionToCorporateActionParams(corporateAction, details, context); expect(result).toEqual({ ...fakeResult, kind: CorporateActionKind.Other }); @@ -5872,7 +5872,7 @@ describe('meshCorporateActionToCorporateActionParams', () => { kind: dsMockUtils.createMockCAKind('Reorganization'), }); - result = meshCorporateActionToCorporateActionParams(corporateAction, context); + result = meshCorporateActionToCorporateActionParams(corporateAction, details, context); expect(result).toEqual({ ...fakeResult, kind: CorporateActionKind.Reorganization }); }); diff --git a/src/utils/conversion.ts b/src/utils/conversion.ts index 5863036f2a..97364c5ec6 100644 --- a/src/utils/conversion.ts +++ b/src/utils/conversion.ts @@ -1333,7 +1333,8 @@ export function assetTypeToString(assetType: AssetType): string { return KnownTokenType.StableCoin; } - return u8aToString(assetType.asCustom); + // TODO @monitz87: figure out how to return this properly (probably make it async and have it fetch the value) + return u32ToBigNumber(assetType.asCustom).toFormat(); } /** @@ -3059,12 +3060,12 @@ export function stringToSignature(signature: string, context: Context): Signatur */ export function meshCorporateActionToCorporateActionParams( corporateAction: MeshCorporateAction, + details: Text, context: Context ): CorporateActionParams { const { kind: rawKind, decl_date: declDate, - details, targets: { identities, treatment }, default_withholding_tax: defaultWithholdingTax, withholding_tax: withholdingTax,