@awarizon/sdk 2.1.2 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -177,12 +177,49 @@ interface NameLookup {
177
177
  account: string;
178
178
  identity: IdentityRecord | null;
179
179
  }
180
+ type DexAssetWire = 'native' | {
181
+ token: number;
182
+ };
183
+ interface DexPoolResponse {
184
+ asset_a: DexAssetWire;
185
+ asset_b: DexAssetWire;
186
+ reserve_a: string;
187
+ reserve_b: string;
188
+ lp_total_supply: string;
189
+ lp_asset_id: number;
190
+ total_volume: string;
191
+ total_fees: string;
192
+ total_burned: string;
193
+ fee_bps: number;
194
+ is_riz_pair: boolean;
195
+ created_at: number;
196
+ last_updated_block: number;
197
+ }
198
+ interface DexQuoteResponse {
199
+ asset_in: DexAssetWire;
200
+ asset_out: DexAssetWire;
201
+ amount_in: string;
202
+ amount_out: string;
203
+ fee: string;
204
+ protocol_fee: string;
205
+ price_impact_bps: number;
206
+ path: DexAssetWire[];
207
+ via_riz: boolean;
208
+ }
209
+ interface DexTwapResponse {
210
+ price_a_cumulative: string;
211
+ price_b_cumulative: string;
212
+ last_block: number;
213
+ spot_price_a_per_b: string;
214
+ spot_price_b_per_a: string;
215
+ }
180
216
 
181
217
  declare const PLANCK = 1n;
182
218
  declare const RIZ = 1000000000000n;
183
219
  declare const MICRO_RIZ = 1000000n;
184
220
  declare const MILLI_RIZ = 1000000000n;
185
221
  declare const DEFAULT_ENDPOINT = "wss://rpc.awarizon.com";
222
+ declare const DEFAULT_INDEXER_ENDPOINT = "https://index.awarizon.com";
186
223
  declare const CHAIN_NAME = "Awarizon";
187
224
  declare const GENESIS_VALIDATORS = 51;
188
225
  declare const TARGET_VALIDATORS = 121;
@@ -460,6 +497,50 @@ declare const awarizonRpc: {
460
497
  type: string;
461
498
  };
462
499
  };
500
+ dex: {
501
+ getPool: {
502
+ description: string;
503
+ params: {
504
+ name: string;
505
+ type: string;
506
+ }[];
507
+ type: string;
508
+ };
509
+ getQuote: {
510
+ description: string;
511
+ params: {
512
+ name: string;
513
+ type: string;
514
+ }[];
515
+ type: string;
516
+ };
517
+ getTwap: {
518
+ description: string;
519
+ params: {
520
+ name: string;
521
+ type: string;
522
+ }[];
523
+ type: string;
524
+ };
525
+ getAllPools: {
526
+ description: string;
527
+ params: {
528
+ name: string;
529
+ type: string;
530
+ }[];
531
+ type: string;
532
+ };
533
+ getFeeDestination: {
534
+ description: string;
535
+ params: never[];
536
+ type: string;
537
+ };
538
+ getTotalBurned: {
539
+ description: string;
540
+ params: never[];
541
+ type: string;
542
+ };
543
+ };
463
544
  };
464
545
 
465
546
  declare function getDeveloperProfile(api: ApiPromise, account: string): Promise<DeveloperProfile | null>;
@@ -485,6 +566,12 @@ declare function lookupName(api: ApiPromise, name: string): Promise<NameLookup |
485
566
  declare function getLinkedAddresses(api: ApiPromise, account: string): Promise<LinkedAddress[]>;
486
567
  declare function isNameAvailable(api: ApiPromise, name: string): Promise<boolean>;
487
568
  declare function getTotalIdentities(api: ApiPromise): Promise<number>;
569
+ declare function getDexPool(api: ApiPromise, assetA: DexAssetWire, assetB: DexAssetWire): Promise<DexPoolResponse | null>;
570
+ declare function getDexQuote(api: ApiPromise, assetIn: DexAssetWire, assetOut: DexAssetWire, amountIn: string): Promise<DexQuoteResponse>;
571
+ declare function getDexTwap(api: ApiPromise, assetA: DexAssetWire, assetB: DexAssetWire): Promise<DexTwapResponse | null>;
572
+ declare function getAllDexPools(api: ApiPromise, limit?: number): Promise<DexPoolResponse[]>;
573
+ declare function getDexFeeDestination(api: ApiPromise): Promise<'burn' | 'treasury'>;
574
+ declare function getDexTotalBurned(api: ApiPromise): Promise<string>;
488
575
 
489
576
  declare function buildRegisterDeveloper(api: ApiPromise): SubmittableExtrinsic<'promise', ISubmittableResult>;
490
577
  declare function buildStakeRiz(api: ApiPromise, amount: bigint): SubmittableExtrinsic<'promise', ISubmittableResult>;
@@ -533,6 +620,15 @@ blocksBps: number): SubmittableExtrinsic<'promise', ISubmittableResult>;
533
620
  declare function buildRunEpochElection(api: ApiPromise, epoch: bigint): SubmittableExtrinsic<'promise', ISubmittableResult>;
534
621
  declare function buildSlashValidator(api: ApiPromise, validator: string, // SS58 address
535
622
  reason: number): SubmittableExtrinsic<'promise', ISubmittableResult>;
623
+ declare function buildSetCommission(api: ApiPromise, commission: number): SubmittableExtrinsic<'promise', ISubmittableResult>;
624
+ declare function buildClaimValidatorReward(api: ApiPromise): SubmittableExtrinsic<'promise', ISubmittableResult>;
625
+ declare function buildClaimDelegationReward(api: ApiPromise, validator: string): SubmittableExtrinsic<'promise', ISubmittableResult>;
626
+ declare function buildClaimAllDelegationRewards(api: ApiPromise): SubmittableExtrinsic<'promise', ISubmittableResult>;
627
+ declare function buildReportOffline(api: ApiPromise, validator: string, // SS58 address
628
+ missedBlocks: number): SubmittableExtrinsic<'promise', ISubmittableResult>;
629
+ declare function buildReportDoubleSign(api: ApiPromise, validator: string): SubmittableExtrinsic<'promise', ISubmittableResult>;
630
+ declare function buildClaimSlashCompensation(api: ApiPromise, validator: string): SubmittableExtrinsic<'promise', ISubmittableResult>;
631
+ declare function buildInitYieldReserve(api: ApiPromise): SubmittableExtrinsic<'promise', ISubmittableResult>;
536
632
 
537
633
  declare function buildCreateAsset(api: ApiPromise, id: number, // AssetId (u32)
538
634
  admin: string, // SS58 address — asset admin account
@@ -667,4 +763,4 @@ declare class MaxValidatorsReachedError extends AwarizonError {
667
763
  }
668
764
  declare function parseChainError(error: unknown): AwarizonError;
669
765
 
670
- export { AlreadyDelegatedError, type AppCategory, type AppManifest, AwarizonClient, AwarizonError, BLOCK_TIME_SECONDS, CHAIN_NAME, type Campaign, CampaignDeliveryLimitReachedError, type CampaignDeliveryStatus, CampaignExpiredError, CampaignNotActiveError, CampaignNotFoundError, type CampaignStatus, CannotDelegateToSelfError, type ChainType, CountryCapExceededError, DEFAULT_CAMPAIGN_DURATION_DAYS, DEFAULT_ENDPOINT, DEVELOPER_MIN_TENURE_DAYS, type Delegation, DelegationNotFoundError, DeveloperAlreadyRegisteredError, DeveloperNotFoundError, DeveloperNotVerifiedError, type DeveloperProfile, type DeveloperStatus, DeveloperSuspendedError, ENGAGEMENT_COOLDOWN_HOURS, EPOCH_LENGTH_BLOCKS, EngagementCooldownActiveError, EngagementDailyLimitReachedError, type EngagementEvent, EngagementInvalidError, EpochNotReadyError, GENESIS_VALIDATORS, type IdentityRecord, InboxAlreadyDeliveredError, InboxFullError, type InboxRecord, InboxRecordNotFoundError, type InboxRecordStatus, InsufficientBalanceError, InsufficientStakeError, InvalidCampaignIdError, InvalidManifestHashError, type LinkStatus, type LinkedAddress, MAX_CAMPAIGN_DURATION_DAYS, MAX_CATEGORY_HISTORY_ENTRIES, MAX_ENGAGEMENT_EVENTS_PER_DAY, MAX_REGION_CODES_PER_CAMPAIGN, MAX_TARGETING_DIMENSIONS, MICRO_RIZ, MILLI_RIZ, MIN_CAMPAIGN_DURATION_DAYS, MIN_INTERACTIONS, MIN_SESSION_SECONDS, ManifestAlreadyRegisteredError, ManifestLimitReachedError, ManifestNotFoundError, MaxValidatorsReachedError, type NameLookup, type NetworkStats, NotExpiredYetError, PERF_WEIGHT_BLOCKS_BPS, PERF_WEIGHT_FINALITY_BPS, PERF_WEIGHT_SLASH_BPS, PERF_WEIGHT_UPTIME_BPS, PLANCK, RIZ, RegionCapExceededError, ResetNotReadyError, TARGET_VALIDATORS, type TargetingCriteria, TargetingDimensionLimitExceededError, type TokenStats, type TransactionSummary, type TransactionType, UnauthorizedError, ValidatorAlreadyRegisteredError, type ValidatorInfo, ValidatorNotActiveError, ValidatorNotFoundError, type ValidatorPerformance, type ValidatorPerformanceResponse, type VestingSchedule, type WalletTargetingProfile, aliceKeypair, awarizonRpc, awarizonTypes, blocksToTime, bobKeypair, buildAdvanceEpoch, buildBloomFilter, buildCheckWalletMatch, buildClaimReward, buildCreateAsset, buildCreateCampaign, buildDelegateStake, buildDeliverToInbox, buildDismissInboxRecord, buildExpireCampaign, buildMintAsset, buildRegisterDeveloper, buildRegisterManifest, buildRegisterValidator, buildResetDailyEngagement, buildRunEpochElection, buildRunTargetingBatch, buildSlashValidator, buildStakeRiz, buildSubmitEngagement, buildTerminateCampaign, buildTransferAsset, buildUndelegateStake, buildUpdatePerformance, buildUpdateWalletIndex, bytesToHex, checkCampaignMatch, connect, createKeyring, formatRiz, generateCampaignId, getActiveCampaignCount, getActiveValidators, getBlockTransactions, getCampaign, getCampaignDeliveryStatus, getDeveloperCampaigns, getDeveloperManifests, getDeveloperProfile, getIdentity, getInboxCount, getInboxRecord, getLinkedAddresses, getNetworkStats, getRecentTransactions, getTokenStats, getTotalIdentities, getValidatorCount, getValidatorPerformance, getVestingSchedule, getWalletTargetingProfile, hexToBytes, isNameAvailable, isValidAddress, keypairFromMnemonic, keypairFromSeed, lookupName, parseChainError, parsePlanckString, parseRiz, signAndSend };
766
+ export { AlreadyDelegatedError, type AppCategory, type AppManifest, AwarizonClient, AwarizonError, BLOCK_TIME_SECONDS, CHAIN_NAME, type Campaign, CampaignDeliveryLimitReachedError, type CampaignDeliveryStatus, CampaignExpiredError, CampaignNotActiveError, CampaignNotFoundError, type CampaignStatus, CannotDelegateToSelfError, type ChainType, CountryCapExceededError, DEFAULT_CAMPAIGN_DURATION_DAYS, DEFAULT_ENDPOINT, DEFAULT_INDEXER_ENDPOINT, DEVELOPER_MIN_TENURE_DAYS, type Delegation, DelegationNotFoundError, DeveloperAlreadyRegisteredError, DeveloperNotFoundError, DeveloperNotVerifiedError, type DeveloperProfile, type DeveloperStatus, DeveloperSuspendedError, type DexAssetWire, type DexPoolResponse, type DexQuoteResponse, type DexTwapResponse, ENGAGEMENT_COOLDOWN_HOURS, EPOCH_LENGTH_BLOCKS, EngagementCooldownActiveError, EngagementDailyLimitReachedError, type EngagementEvent, EngagementInvalidError, EpochNotReadyError, GENESIS_VALIDATORS, type IdentityRecord, InboxAlreadyDeliveredError, InboxFullError, type InboxRecord, InboxRecordNotFoundError, type InboxRecordStatus, InsufficientBalanceError, InsufficientStakeError, InvalidCampaignIdError, InvalidManifestHashError, type LinkStatus, type LinkedAddress, MAX_CAMPAIGN_DURATION_DAYS, MAX_CATEGORY_HISTORY_ENTRIES, MAX_ENGAGEMENT_EVENTS_PER_DAY, MAX_REGION_CODES_PER_CAMPAIGN, MAX_TARGETING_DIMENSIONS, MICRO_RIZ, MILLI_RIZ, MIN_CAMPAIGN_DURATION_DAYS, MIN_INTERACTIONS, MIN_SESSION_SECONDS, ManifestAlreadyRegisteredError, ManifestLimitReachedError, ManifestNotFoundError, MaxValidatorsReachedError, type NameLookup, type NetworkStats, NotExpiredYetError, PERF_WEIGHT_BLOCKS_BPS, PERF_WEIGHT_FINALITY_BPS, PERF_WEIGHT_SLASH_BPS, PERF_WEIGHT_UPTIME_BPS, PLANCK, RIZ, RegionCapExceededError, ResetNotReadyError, TARGET_VALIDATORS, type TargetingCriteria, TargetingDimensionLimitExceededError, type TokenStats, type TransactionSummary, type TransactionType, UnauthorizedError, ValidatorAlreadyRegisteredError, type ValidatorInfo, ValidatorNotActiveError, ValidatorNotFoundError, type ValidatorPerformance, type ValidatorPerformanceResponse, type VestingSchedule, type WalletTargetingProfile, aliceKeypair, awarizonRpc, awarizonTypes, blocksToTime, bobKeypair, buildAdvanceEpoch, buildBloomFilter, buildCheckWalletMatch, buildClaimAllDelegationRewards, buildClaimDelegationReward, buildClaimReward, buildClaimSlashCompensation, buildClaimValidatorReward, buildCreateAsset, buildCreateCampaign, buildDelegateStake, buildDeliverToInbox, buildDismissInboxRecord, buildExpireCampaign, buildInitYieldReserve, buildMintAsset, buildRegisterDeveloper, buildRegisterManifest, buildRegisterValidator, buildReportDoubleSign, buildReportOffline, buildResetDailyEngagement, buildRunEpochElection, buildRunTargetingBatch, buildSetCommission, buildSlashValidator, buildStakeRiz, buildSubmitEngagement, buildTerminateCampaign, buildTransferAsset, buildUndelegateStake, buildUpdatePerformance, buildUpdateWalletIndex, bytesToHex, checkCampaignMatch, connect, createKeyring, formatRiz, generateCampaignId, getActiveCampaignCount, getActiveValidators, getAllDexPools, getBlockTransactions, getCampaign, getCampaignDeliveryStatus, getDeveloperCampaigns, getDeveloperManifests, getDeveloperProfile, getDexFeeDestination, getDexPool, getDexQuote, getDexTotalBurned, getDexTwap, getIdentity, getInboxCount, getInboxRecord, getLinkedAddresses, getNetworkStats, getRecentTransactions, getTokenStats, getTotalIdentities, getValidatorCount, getValidatorPerformance, getVestingSchedule, getWalletTargetingProfile, hexToBytes, isNameAvailable, isValidAddress, keypairFromMnemonic, keypairFromSeed, lookupName, parseChainError, parsePlanckString, parseRiz, signAndSend };
package/dist/index.d.ts CHANGED
@@ -177,12 +177,49 @@ interface NameLookup {
177
177
  account: string;
178
178
  identity: IdentityRecord | null;
179
179
  }
180
+ type DexAssetWire = 'native' | {
181
+ token: number;
182
+ };
183
+ interface DexPoolResponse {
184
+ asset_a: DexAssetWire;
185
+ asset_b: DexAssetWire;
186
+ reserve_a: string;
187
+ reserve_b: string;
188
+ lp_total_supply: string;
189
+ lp_asset_id: number;
190
+ total_volume: string;
191
+ total_fees: string;
192
+ total_burned: string;
193
+ fee_bps: number;
194
+ is_riz_pair: boolean;
195
+ created_at: number;
196
+ last_updated_block: number;
197
+ }
198
+ interface DexQuoteResponse {
199
+ asset_in: DexAssetWire;
200
+ asset_out: DexAssetWire;
201
+ amount_in: string;
202
+ amount_out: string;
203
+ fee: string;
204
+ protocol_fee: string;
205
+ price_impact_bps: number;
206
+ path: DexAssetWire[];
207
+ via_riz: boolean;
208
+ }
209
+ interface DexTwapResponse {
210
+ price_a_cumulative: string;
211
+ price_b_cumulative: string;
212
+ last_block: number;
213
+ spot_price_a_per_b: string;
214
+ spot_price_b_per_a: string;
215
+ }
180
216
 
181
217
  declare const PLANCK = 1n;
182
218
  declare const RIZ = 1000000000000n;
183
219
  declare const MICRO_RIZ = 1000000n;
184
220
  declare const MILLI_RIZ = 1000000000n;
185
221
  declare const DEFAULT_ENDPOINT = "wss://rpc.awarizon.com";
222
+ declare const DEFAULT_INDEXER_ENDPOINT = "https://index.awarizon.com";
186
223
  declare const CHAIN_NAME = "Awarizon";
187
224
  declare const GENESIS_VALIDATORS = 51;
188
225
  declare const TARGET_VALIDATORS = 121;
@@ -460,6 +497,50 @@ declare const awarizonRpc: {
460
497
  type: string;
461
498
  };
462
499
  };
500
+ dex: {
501
+ getPool: {
502
+ description: string;
503
+ params: {
504
+ name: string;
505
+ type: string;
506
+ }[];
507
+ type: string;
508
+ };
509
+ getQuote: {
510
+ description: string;
511
+ params: {
512
+ name: string;
513
+ type: string;
514
+ }[];
515
+ type: string;
516
+ };
517
+ getTwap: {
518
+ description: string;
519
+ params: {
520
+ name: string;
521
+ type: string;
522
+ }[];
523
+ type: string;
524
+ };
525
+ getAllPools: {
526
+ description: string;
527
+ params: {
528
+ name: string;
529
+ type: string;
530
+ }[];
531
+ type: string;
532
+ };
533
+ getFeeDestination: {
534
+ description: string;
535
+ params: never[];
536
+ type: string;
537
+ };
538
+ getTotalBurned: {
539
+ description: string;
540
+ params: never[];
541
+ type: string;
542
+ };
543
+ };
463
544
  };
464
545
 
465
546
  declare function getDeveloperProfile(api: ApiPromise, account: string): Promise<DeveloperProfile | null>;
@@ -485,6 +566,12 @@ declare function lookupName(api: ApiPromise, name: string): Promise<NameLookup |
485
566
  declare function getLinkedAddresses(api: ApiPromise, account: string): Promise<LinkedAddress[]>;
486
567
  declare function isNameAvailable(api: ApiPromise, name: string): Promise<boolean>;
487
568
  declare function getTotalIdentities(api: ApiPromise): Promise<number>;
569
+ declare function getDexPool(api: ApiPromise, assetA: DexAssetWire, assetB: DexAssetWire): Promise<DexPoolResponse | null>;
570
+ declare function getDexQuote(api: ApiPromise, assetIn: DexAssetWire, assetOut: DexAssetWire, amountIn: string): Promise<DexQuoteResponse>;
571
+ declare function getDexTwap(api: ApiPromise, assetA: DexAssetWire, assetB: DexAssetWire): Promise<DexTwapResponse | null>;
572
+ declare function getAllDexPools(api: ApiPromise, limit?: number): Promise<DexPoolResponse[]>;
573
+ declare function getDexFeeDestination(api: ApiPromise): Promise<'burn' | 'treasury'>;
574
+ declare function getDexTotalBurned(api: ApiPromise): Promise<string>;
488
575
 
489
576
  declare function buildRegisterDeveloper(api: ApiPromise): SubmittableExtrinsic<'promise', ISubmittableResult>;
490
577
  declare function buildStakeRiz(api: ApiPromise, amount: bigint): SubmittableExtrinsic<'promise', ISubmittableResult>;
@@ -533,6 +620,15 @@ blocksBps: number): SubmittableExtrinsic<'promise', ISubmittableResult>;
533
620
  declare function buildRunEpochElection(api: ApiPromise, epoch: bigint): SubmittableExtrinsic<'promise', ISubmittableResult>;
534
621
  declare function buildSlashValidator(api: ApiPromise, validator: string, // SS58 address
535
622
  reason: number): SubmittableExtrinsic<'promise', ISubmittableResult>;
623
+ declare function buildSetCommission(api: ApiPromise, commission: number): SubmittableExtrinsic<'promise', ISubmittableResult>;
624
+ declare function buildClaimValidatorReward(api: ApiPromise): SubmittableExtrinsic<'promise', ISubmittableResult>;
625
+ declare function buildClaimDelegationReward(api: ApiPromise, validator: string): SubmittableExtrinsic<'promise', ISubmittableResult>;
626
+ declare function buildClaimAllDelegationRewards(api: ApiPromise): SubmittableExtrinsic<'promise', ISubmittableResult>;
627
+ declare function buildReportOffline(api: ApiPromise, validator: string, // SS58 address
628
+ missedBlocks: number): SubmittableExtrinsic<'promise', ISubmittableResult>;
629
+ declare function buildReportDoubleSign(api: ApiPromise, validator: string): SubmittableExtrinsic<'promise', ISubmittableResult>;
630
+ declare function buildClaimSlashCompensation(api: ApiPromise, validator: string): SubmittableExtrinsic<'promise', ISubmittableResult>;
631
+ declare function buildInitYieldReserve(api: ApiPromise): SubmittableExtrinsic<'promise', ISubmittableResult>;
536
632
 
537
633
  declare function buildCreateAsset(api: ApiPromise, id: number, // AssetId (u32)
538
634
  admin: string, // SS58 address — asset admin account
@@ -667,4 +763,4 @@ declare class MaxValidatorsReachedError extends AwarizonError {
667
763
  }
668
764
  declare function parseChainError(error: unknown): AwarizonError;
669
765
 
670
- export { AlreadyDelegatedError, type AppCategory, type AppManifest, AwarizonClient, AwarizonError, BLOCK_TIME_SECONDS, CHAIN_NAME, type Campaign, CampaignDeliveryLimitReachedError, type CampaignDeliveryStatus, CampaignExpiredError, CampaignNotActiveError, CampaignNotFoundError, type CampaignStatus, CannotDelegateToSelfError, type ChainType, CountryCapExceededError, DEFAULT_CAMPAIGN_DURATION_DAYS, DEFAULT_ENDPOINT, DEVELOPER_MIN_TENURE_DAYS, type Delegation, DelegationNotFoundError, DeveloperAlreadyRegisteredError, DeveloperNotFoundError, DeveloperNotVerifiedError, type DeveloperProfile, type DeveloperStatus, DeveloperSuspendedError, ENGAGEMENT_COOLDOWN_HOURS, EPOCH_LENGTH_BLOCKS, EngagementCooldownActiveError, EngagementDailyLimitReachedError, type EngagementEvent, EngagementInvalidError, EpochNotReadyError, GENESIS_VALIDATORS, type IdentityRecord, InboxAlreadyDeliveredError, InboxFullError, type InboxRecord, InboxRecordNotFoundError, type InboxRecordStatus, InsufficientBalanceError, InsufficientStakeError, InvalidCampaignIdError, InvalidManifestHashError, type LinkStatus, type LinkedAddress, MAX_CAMPAIGN_DURATION_DAYS, MAX_CATEGORY_HISTORY_ENTRIES, MAX_ENGAGEMENT_EVENTS_PER_DAY, MAX_REGION_CODES_PER_CAMPAIGN, MAX_TARGETING_DIMENSIONS, MICRO_RIZ, MILLI_RIZ, MIN_CAMPAIGN_DURATION_DAYS, MIN_INTERACTIONS, MIN_SESSION_SECONDS, ManifestAlreadyRegisteredError, ManifestLimitReachedError, ManifestNotFoundError, MaxValidatorsReachedError, type NameLookup, type NetworkStats, NotExpiredYetError, PERF_WEIGHT_BLOCKS_BPS, PERF_WEIGHT_FINALITY_BPS, PERF_WEIGHT_SLASH_BPS, PERF_WEIGHT_UPTIME_BPS, PLANCK, RIZ, RegionCapExceededError, ResetNotReadyError, TARGET_VALIDATORS, type TargetingCriteria, TargetingDimensionLimitExceededError, type TokenStats, type TransactionSummary, type TransactionType, UnauthorizedError, ValidatorAlreadyRegisteredError, type ValidatorInfo, ValidatorNotActiveError, ValidatorNotFoundError, type ValidatorPerformance, type ValidatorPerformanceResponse, type VestingSchedule, type WalletTargetingProfile, aliceKeypair, awarizonRpc, awarizonTypes, blocksToTime, bobKeypair, buildAdvanceEpoch, buildBloomFilter, buildCheckWalletMatch, buildClaimReward, buildCreateAsset, buildCreateCampaign, buildDelegateStake, buildDeliverToInbox, buildDismissInboxRecord, buildExpireCampaign, buildMintAsset, buildRegisterDeveloper, buildRegisterManifest, buildRegisterValidator, buildResetDailyEngagement, buildRunEpochElection, buildRunTargetingBatch, buildSlashValidator, buildStakeRiz, buildSubmitEngagement, buildTerminateCampaign, buildTransferAsset, buildUndelegateStake, buildUpdatePerformance, buildUpdateWalletIndex, bytesToHex, checkCampaignMatch, connect, createKeyring, formatRiz, generateCampaignId, getActiveCampaignCount, getActiveValidators, getBlockTransactions, getCampaign, getCampaignDeliveryStatus, getDeveloperCampaigns, getDeveloperManifests, getDeveloperProfile, getIdentity, getInboxCount, getInboxRecord, getLinkedAddresses, getNetworkStats, getRecentTransactions, getTokenStats, getTotalIdentities, getValidatorCount, getValidatorPerformance, getVestingSchedule, getWalletTargetingProfile, hexToBytes, isNameAvailable, isValidAddress, keypairFromMnemonic, keypairFromSeed, lookupName, parseChainError, parsePlanckString, parseRiz, signAndSend };
766
+ export { AlreadyDelegatedError, type AppCategory, type AppManifest, AwarizonClient, AwarizonError, BLOCK_TIME_SECONDS, CHAIN_NAME, type Campaign, CampaignDeliveryLimitReachedError, type CampaignDeliveryStatus, CampaignExpiredError, CampaignNotActiveError, CampaignNotFoundError, type CampaignStatus, CannotDelegateToSelfError, type ChainType, CountryCapExceededError, DEFAULT_CAMPAIGN_DURATION_DAYS, DEFAULT_ENDPOINT, DEFAULT_INDEXER_ENDPOINT, DEVELOPER_MIN_TENURE_DAYS, type Delegation, DelegationNotFoundError, DeveloperAlreadyRegisteredError, DeveloperNotFoundError, DeveloperNotVerifiedError, type DeveloperProfile, type DeveloperStatus, DeveloperSuspendedError, type DexAssetWire, type DexPoolResponse, type DexQuoteResponse, type DexTwapResponse, ENGAGEMENT_COOLDOWN_HOURS, EPOCH_LENGTH_BLOCKS, EngagementCooldownActiveError, EngagementDailyLimitReachedError, type EngagementEvent, EngagementInvalidError, EpochNotReadyError, GENESIS_VALIDATORS, type IdentityRecord, InboxAlreadyDeliveredError, InboxFullError, type InboxRecord, InboxRecordNotFoundError, type InboxRecordStatus, InsufficientBalanceError, InsufficientStakeError, InvalidCampaignIdError, InvalidManifestHashError, type LinkStatus, type LinkedAddress, MAX_CAMPAIGN_DURATION_DAYS, MAX_CATEGORY_HISTORY_ENTRIES, MAX_ENGAGEMENT_EVENTS_PER_DAY, MAX_REGION_CODES_PER_CAMPAIGN, MAX_TARGETING_DIMENSIONS, MICRO_RIZ, MILLI_RIZ, MIN_CAMPAIGN_DURATION_DAYS, MIN_INTERACTIONS, MIN_SESSION_SECONDS, ManifestAlreadyRegisteredError, ManifestLimitReachedError, ManifestNotFoundError, MaxValidatorsReachedError, type NameLookup, type NetworkStats, NotExpiredYetError, PERF_WEIGHT_BLOCKS_BPS, PERF_WEIGHT_FINALITY_BPS, PERF_WEIGHT_SLASH_BPS, PERF_WEIGHT_UPTIME_BPS, PLANCK, RIZ, RegionCapExceededError, ResetNotReadyError, TARGET_VALIDATORS, type TargetingCriteria, TargetingDimensionLimitExceededError, type TokenStats, type TransactionSummary, type TransactionType, UnauthorizedError, ValidatorAlreadyRegisteredError, type ValidatorInfo, ValidatorNotActiveError, ValidatorNotFoundError, type ValidatorPerformance, type ValidatorPerformanceResponse, type VestingSchedule, type WalletTargetingProfile, aliceKeypair, awarizonRpc, awarizonTypes, blocksToTime, bobKeypair, buildAdvanceEpoch, buildBloomFilter, buildCheckWalletMatch, buildClaimAllDelegationRewards, buildClaimDelegationReward, buildClaimReward, buildClaimSlashCompensation, buildClaimValidatorReward, buildCreateAsset, buildCreateCampaign, buildDelegateStake, buildDeliverToInbox, buildDismissInboxRecord, buildExpireCampaign, buildInitYieldReserve, buildMintAsset, buildRegisterDeveloper, buildRegisterManifest, buildRegisterValidator, buildReportDoubleSign, buildReportOffline, buildResetDailyEngagement, buildRunEpochElection, buildRunTargetingBatch, buildSetCommission, buildSlashValidator, buildStakeRiz, buildSubmitEngagement, buildTerminateCampaign, buildTransferAsset, buildUndelegateStake, buildUpdatePerformance, buildUpdateWalletIndex, bytesToHex, checkCampaignMatch, connect, createKeyring, formatRiz, generateCampaignId, getActiveCampaignCount, getActiveValidators, getAllDexPools, getBlockTransactions, getCampaign, getCampaignDeliveryStatus, getDeveloperCampaigns, getDeveloperManifests, getDeveloperProfile, getDexFeeDestination, getDexPool, getDexQuote, getDexTotalBurned, getDexTwap, getIdentity, getInboxCount, getInboxRecord, getLinkedAddresses, getNetworkStats, getRecentTransactions, getTokenStats, getTotalIdentities, getValidatorCount, getValidatorPerformance, getVestingSchedule, getWalletTargetingProfile, hexToBytes, isNameAvailable, isValidAddress, keypairFromMnemonic, keypairFromSeed, lookupName, parseChainError, parsePlanckString, parseRiz, signAndSend };
package/dist/index.js CHANGED
@@ -33,6 +33,7 @@ __export(index_exports, {
33
33
  CountryCapExceededError: () => CountryCapExceededError,
34
34
  DEFAULT_CAMPAIGN_DURATION_DAYS: () => DEFAULT_CAMPAIGN_DURATION_DAYS,
35
35
  DEFAULT_ENDPOINT: () => DEFAULT_ENDPOINT,
36
+ DEFAULT_INDEXER_ENDPOINT: () => DEFAULT_INDEXER_ENDPOINT,
36
37
  DEVELOPER_MIN_TENURE_DAYS: () => DEVELOPER_MIN_TENURE_DAYS,
37
38
  DelegationNotFoundError: () => DelegationNotFoundError,
38
39
  DeveloperAlreadyRegisteredError: () => DeveloperAlreadyRegisteredError,
@@ -90,20 +91,28 @@ __export(index_exports, {
90
91
  buildAdvanceEpoch: () => buildAdvanceEpoch,
91
92
  buildBloomFilter: () => buildBloomFilter,
92
93
  buildCheckWalletMatch: () => buildCheckWalletMatch,
94
+ buildClaimAllDelegationRewards: () => buildClaimAllDelegationRewards,
95
+ buildClaimDelegationReward: () => buildClaimDelegationReward,
93
96
  buildClaimReward: () => buildClaimReward,
97
+ buildClaimSlashCompensation: () => buildClaimSlashCompensation,
98
+ buildClaimValidatorReward: () => buildClaimValidatorReward,
94
99
  buildCreateAsset: () => buildCreateAsset,
95
100
  buildCreateCampaign: () => buildCreateCampaign,
96
101
  buildDelegateStake: () => buildDelegateStake,
97
102
  buildDeliverToInbox: () => buildDeliverToInbox,
98
103
  buildDismissInboxRecord: () => buildDismissInboxRecord,
99
104
  buildExpireCampaign: () => buildExpireCampaign,
105
+ buildInitYieldReserve: () => buildInitYieldReserve,
100
106
  buildMintAsset: () => buildMintAsset,
101
107
  buildRegisterDeveloper: () => buildRegisterDeveloper,
102
108
  buildRegisterManifest: () => buildRegisterManifest,
103
109
  buildRegisterValidator: () => buildRegisterValidator,
110
+ buildReportDoubleSign: () => buildReportDoubleSign,
111
+ buildReportOffline: () => buildReportOffline,
104
112
  buildResetDailyEngagement: () => buildResetDailyEngagement,
105
113
  buildRunEpochElection: () => buildRunEpochElection,
106
114
  buildRunTargetingBatch: () => buildRunTargetingBatch,
115
+ buildSetCommission: () => buildSetCommission,
107
116
  buildSlashValidator: () => buildSlashValidator,
108
117
  buildStakeRiz: () => buildStakeRiz,
109
118
  buildSubmitEngagement: () => buildSubmitEngagement,
@@ -120,12 +129,18 @@ __export(index_exports, {
120
129
  generateCampaignId: () => generateCampaignId,
121
130
  getActiveCampaignCount: () => getActiveCampaignCount,
122
131
  getActiveValidators: () => getActiveValidators,
132
+ getAllDexPools: () => getAllDexPools,
123
133
  getBlockTransactions: () => getBlockTransactions,
124
134
  getCampaign: () => getCampaign,
125
135
  getCampaignDeliveryStatus: () => getCampaignDeliveryStatus,
126
136
  getDeveloperCampaigns: () => getDeveloperCampaigns,
127
137
  getDeveloperManifests: () => getDeveloperManifests,
128
138
  getDeveloperProfile: () => getDeveloperProfile,
139
+ getDexFeeDestination: () => getDexFeeDestination,
140
+ getDexPool: () => getDexPool,
141
+ getDexQuote: () => getDexQuote,
142
+ getDexTotalBurned: () => getDexTotalBurned,
143
+ getDexTwap: () => getDexTwap,
129
144
  getIdentity: () => getIdentity,
130
145
  getInboxCount: () => getInboxCount,
131
146
  getInboxRecord: () => getInboxRecord,
@@ -400,6 +415,55 @@ var awarizonRpc = {
400
415
  ],
401
416
  type: "Json"
402
417
  }
418
+ },
419
+ // DEX endpoints — separate "dex" namespace, unlike the rest of the
420
+ // RPC surface which lives under "awarizon". Matches the wire names
421
+ // in node/src/awarizon_rpc.rs (dex_getPool, dex_getQuote, ...).
422
+ // Asset params/returns are serde JSON (a bare string "native" or a
423
+ // { token: n } object), not SCALE — declared as 'Json' so
424
+ // @polkadot/api passes them through unchanged instead of trying to
425
+ // SCALE-encode/decode them.
426
+ dex: {
427
+ getPool: {
428
+ description: "Get pool info for an asset pair",
429
+ params: [
430
+ { name: "asset_a", type: "Json" },
431
+ { name: "asset_b", type: "Json" }
432
+ ],
433
+ type: "Json"
434
+ },
435
+ getQuote: {
436
+ description: "Get a price quote for a swap",
437
+ params: [
438
+ { name: "asset_in", type: "Json" },
439
+ { name: "asset_out", type: "Json" },
440
+ { name: "amount_in", type: "Text" }
441
+ ],
442
+ type: "Json"
443
+ },
444
+ getTwap: {
445
+ description: "Get TWAP price accumulator data for a pool",
446
+ params: [
447
+ { name: "asset_a", type: "Json" },
448
+ { name: "asset_b", type: "Json" }
449
+ ],
450
+ type: "Json"
451
+ },
452
+ getAllPools: {
453
+ description: "Get all DEX pools, up to limit",
454
+ params: [{ name: "limit", type: "u32" }],
455
+ type: "Json"
456
+ },
457
+ getFeeDestination: {
458
+ description: 'Get protocol fee destination ("burn" or "treasury")',
459
+ params: [],
460
+ type: "Text"
461
+ },
462
+ getTotalBurned: {
463
+ description: "Get total protocol fees burned, as planck decimal string",
464
+ params: [],
465
+ type: "Text"
466
+ }
403
467
  }
404
468
  };
405
469
 
@@ -409,6 +473,7 @@ var RIZ = 1000000000000n;
409
473
  var MICRO_RIZ = 1000000n;
410
474
  var MILLI_RIZ = 1000000000n;
411
475
  var DEFAULT_ENDPOINT = "wss://rpc.awarizon.com";
476
+ var DEFAULT_INDEXER_ENDPOINT = "https://index.awarizon.com";
412
477
  var CHAIN_NAME = "Awarizon";
413
478
  var GENESIS_VALIDATORS = 51;
414
479
  var TARGET_VALIDATORS = 121;
@@ -705,6 +770,30 @@ async function getTotalIdentities(api) {
705
770
  const result = await api.rpc.awarizon.getTotalIdentities(null);
706
771
  return result.toNumber();
707
772
  }
773
+ async function getDexPool(api, assetA, assetB) {
774
+ const result = await api.rpc.dex.getPool(assetA, assetB);
775
+ return result.toJSON();
776
+ }
777
+ async function getDexQuote(api, assetIn, assetOut, amountIn) {
778
+ const result = await api.rpc.dex.getQuote(assetIn, assetOut, amountIn);
779
+ return result.toJSON();
780
+ }
781
+ async function getDexTwap(api, assetA, assetB) {
782
+ const result = await api.rpc.dex.getTwap(assetA, assetB);
783
+ return result.toJSON();
784
+ }
785
+ async function getAllDexPools(api, limit = 50) {
786
+ const result = await api.rpc.dex.getAllPools(limit);
787
+ return result.toJSON() ?? [];
788
+ }
789
+ async function getDexFeeDestination(api) {
790
+ const result = await api.rpc.dex.getFeeDestination();
791
+ return result.toString().toLowerCase() === "treasury" ? "treasury" : "burn";
792
+ }
793
+ async function getDexTotalBurned(api) {
794
+ const result = await api.rpc.dex.getTotalBurned();
795
+ return result.toString();
796
+ }
708
797
 
709
798
  // src/extrinsics/developer.ts
710
799
  function buildRegisterDeveloper(api) {
@@ -803,6 +892,30 @@ function buildRunEpochElection(api, epoch) {
803
892
  function buildSlashValidator(api, validator, reason) {
804
893
  return api.tx.awarizonConsensus.slashValidator(validator, reason);
805
894
  }
895
+ function buildSetCommission(api, commission) {
896
+ return api.tx.awarizonConsensus.setCommission(commission);
897
+ }
898
+ function buildClaimValidatorReward(api) {
899
+ return api.tx.awarizonConsensus.claimValidatorReward();
900
+ }
901
+ function buildClaimDelegationReward(api, validator) {
902
+ return api.tx.awarizonConsensus.claimDelegationReward(validator);
903
+ }
904
+ function buildClaimAllDelegationRewards(api) {
905
+ return api.tx.awarizonConsensus.claimAllDelegationRewards();
906
+ }
907
+ function buildReportOffline(api, validator, missedBlocks) {
908
+ return api.tx.awarizonConsensus.reportOffline(validator, missedBlocks);
909
+ }
910
+ function buildReportDoubleSign(api, validator) {
911
+ return api.tx.awarizonConsensus.reportDoubleSign(validator);
912
+ }
913
+ function buildClaimSlashCompensation(api, validator) {
914
+ return api.tx.awarizonConsensus.claimSlashCompensation(validator);
915
+ }
916
+ function buildInitYieldReserve(api) {
917
+ return api.tx.awarizonConsensus.initYieldReserve();
918
+ }
806
919
 
807
920
  // src/extrinsics/assets.ts
808
921
  function buildCreateAsset(api, id, admin, minBalance) {
@@ -1097,6 +1210,7 @@ async function signAndSend(api, extrinsic, signer) {
1097
1210
  CountryCapExceededError,
1098
1211
  DEFAULT_CAMPAIGN_DURATION_DAYS,
1099
1212
  DEFAULT_ENDPOINT,
1213
+ DEFAULT_INDEXER_ENDPOINT,
1100
1214
  DEVELOPER_MIN_TENURE_DAYS,
1101
1215
  DelegationNotFoundError,
1102
1216
  DeveloperAlreadyRegisteredError,
@@ -1154,20 +1268,28 @@ async function signAndSend(api, extrinsic, signer) {
1154
1268
  buildAdvanceEpoch,
1155
1269
  buildBloomFilter,
1156
1270
  buildCheckWalletMatch,
1271
+ buildClaimAllDelegationRewards,
1272
+ buildClaimDelegationReward,
1157
1273
  buildClaimReward,
1274
+ buildClaimSlashCompensation,
1275
+ buildClaimValidatorReward,
1158
1276
  buildCreateAsset,
1159
1277
  buildCreateCampaign,
1160
1278
  buildDelegateStake,
1161
1279
  buildDeliverToInbox,
1162
1280
  buildDismissInboxRecord,
1163
1281
  buildExpireCampaign,
1282
+ buildInitYieldReserve,
1164
1283
  buildMintAsset,
1165
1284
  buildRegisterDeveloper,
1166
1285
  buildRegisterManifest,
1167
1286
  buildRegisterValidator,
1287
+ buildReportDoubleSign,
1288
+ buildReportOffline,
1168
1289
  buildResetDailyEngagement,
1169
1290
  buildRunEpochElection,
1170
1291
  buildRunTargetingBatch,
1292
+ buildSetCommission,
1171
1293
  buildSlashValidator,
1172
1294
  buildStakeRiz,
1173
1295
  buildSubmitEngagement,
@@ -1184,12 +1306,18 @@ async function signAndSend(api, extrinsic, signer) {
1184
1306
  generateCampaignId,
1185
1307
  getActiveCampaignCount,
1186
1308
  getActiveValidators,
1309
+ getAllDexPools,
1187
1310
  getBlockTransactions,
1188
1311
  getCampaign,
1189
1312
  getCampaignDeliveryStatus,
1190
1313
  getDeveloperCampaigns,
1191
1314
  getDeveloperManifests,
1192
1315
  getDeveloperProfile,
1316
+ getDexFeeDestination,
1317
+ getDexPool,
1318
+ getDexQuote,
1319
+ getDexTotalBurned,
1320
+ getDexTwap,
1193
1321
  getIdentity,
1194
1322
  getInboxCount,
1195
1323
  getInboxRecord,