@awarizon/sdk 2.1.3 → 2.2.1

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,6 +177,42 @@ 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;
@@ -461,6 +497,50 @@ declare const awarizonRpc: {
461
497
  type: string;
462
498
  };
463
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
+ };
464
544
  };
465
545
 
466
546
  declare function getDeveloperProfile(api: ApiPromise, account: string): Promise<DeveloperProfile | null>;
@@ -486,6 +566,12 @@ declare function lookupName(api: ApiPromise, name: string): Promise<NameLookup |
486
566
  declare function getLinkedAddresses(api: ApiPromise, account: string): Promise<LinkedAddress[]>;
487
567
  declare function isNameAvailable(api: ApiPromise, name: string): Promise<boolean>;
488
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>;
489
575
 
490
576
  declare function buildRegisterDeveloper(api: ApiPromise): SubmittableExtrinsic<'promise', ISubmittableResult>;
491
577
  declare function buildStakeRiz(api: ApiPromise, amount: bigint): SubmittableExtrinsic<'promise', ISubmittableResult>;
@@ -677,4 +763,4 @@ declare class MaxValidatorsReachedError extends AwarizonError {
677
763
  }
678
764
  declare function parseChainError(error: unknown): AwarizonError;
679
765
 
680
- 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, 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, 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,6 +177,42 @@ 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;
@@ -461,6 +497,50 @@ declare const awarizonRpc: {
461
497
  type: string;
462
498
  };
463
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
+ };
464
544
  };
465
545
 
466
546
  declare function getDeveloperProfile(api: ApiPromise, account: string): Promise<DeveloperProfile | null>;
@@ -486,6 +566,12 @@ declare function lookupName(api: ApiPromise, name: string): Promise<NameLookup |
486
566
  declare function getLinkedAddresses(api: ApiPromise, account: string): Promise<LinkedAddress[]>;
487
567
  declare function isNameAvailable(api: ApiPromise, name: string): Promise<boolean>;
488
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>;
489
575
 
490
576
  declare function buildRegisterDeveloper(api: ApiPromise): SubmittableExtrinsic<'promise', ISubmittableResult>;
491
577
  declare function buildStakeRiz(api: ApiPromise, amount: bigint): SubmittableExtrinsic<'promise', ISubmittableResult>;
@@ -677,4 +763,4 @@ declare class MaxValidatorsReachedError extends AwarizonError {
677
763
  }
678
764
  declare function parseChainError(error: unknown): AwarizonError;
679
765
 
680
- 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, 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, 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
@@ -129,12 +129,18 @@ __export(index_exports, {
129
129
  generateCampaignId: () => generateCampaignId,
130
130
  getActiveCampaignCount: () => getActiveCampaignCount,
131
131
  getActiveValidators: () => getActiveValidators,
132
+ getAllDexPools: () => getAllDexPools,
132
133
  getBlockTransactions: () => getBlockTransactions,
133
134
  getCampaign: () => getCampaign,
134
135
  getCampaignDeliveryStatus: () => getCampaignDeliveryStatus,
135
136
  getDeveloperCampaigns: () => getDeveloperCampaigns,
136
137
  getDeveloperManifests: () => getDeveloperManifests,
137
138
  getDeveloperProfile: () => getDeveloperProfile,
139
+ getDexFeeDestination: () => getDexFeeDestination,
140
+ getDexPool: () => getDexPool,
141
+ getDexQuote: () => getDexQuote,
142
+ getDexTotalBurned: () => getDexTotalBurned,
143
+ getDexTwap: () => getDexTwap,
138
144
  getIdentity: () => getIdentity,
139
145
  getInboxCount: () => getInboxCount,
140
146
  getInboxRecord: () => getInboxRecord,
@@ -292,7 +298,7 @@ var awarizonRpc = {
292
298
  // Campaign endpoints
293
299
  getCampaign: {
294
300
  description: "Get campaign details by campaign ID (0x hex)",
295
- params: [{ name: "campaign_id", type: "Text" }],
301
+ params: [{ name: "campaign_id", type: "H256" }],
296
302
  type: "Json"
297
303
  },
298
304
  getActiveCampaignCount: {
@@ -302,7 +308,7 @@ var awarizonRpc = {
302
308
  },
303
309
  getCampaignDeliveryStatus: {
304
310
  description: "Get delivery progress for a campaign",
305
- params: [{ name: "campaign_id", type: "Text" }],
311
+ params: [{ name: "campaign_id", type: "H256" }],
306
312
  type: "Json"
307
313
  },
308
314
  // Inbox endpoints
@@ -409,6 +415,55 @@ var awarizonRpc = {
409
415
  ],
410
416
  type: "Json"
411
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
+ }
412
467
  }
413
468
  };
414
469
 
@@ -545,8 +600,8 @@ function parsePlanckString(value) {
545
600
  // src/rpc.ts
546
601
  async function getDeveloperProfile(api, account) {
547
602
  const result = await api.rpc.awarizon.getDeveloperProfile(account);
603
+ if (result.isEmpty) return null;
548
604
  const json = result.toJSON();
549
- if (!json) return null;
550
605
  return {
551
606
  ...json,
552
607
  staked_riz: BigInt(json.staked_riz ?? "0"),
@@ -563,8 +618,8 @@ async function getDeveloperManifests(api, account) {
563
618
  }
564
619
  async function getCampaign(api, campaignId) {
565
620
  const result = await api.rpc.awarizon.getCampaign(campaignId);
621
+ if (result.isEmpty) return null;
566
622
  const json = result.toJSON();
567
- if (!json) return null;
568
623
  return {
569
624
  ...json,
570
625
  max_deliveries: BigInt(json.max_deliveries ?? "0"),
@@ -578,8 +633,8 @@ async function getActiveCampaignCount(api) {
578
633
  }
579
634
  async function getCampaignDeliveryStatus(api, campaignId) {
580
635
  const result = await api.rpc.awarizon.getCampaignDeliveryStatus(campaignId);
636
+ if (result.isEmpty) return null;
581
637
  const json = result.toJSON();
582
- if (!json) return null;
583
638
  return {
584
639
  current_deliveries: BigInt(json.current_deliveries ?? "0"),
585
640
  max_deliveries: BigInt(json.max_deliveries ?? "0"),
@@ -593,9 +648,8 @@ async function getInboxCount(api, wallet) {
593
648
  }
594
649
  async function getInboxRecord(api, wallet, recordId) {
595
650
  const result = await api.rpc.awarizon.getInboxRecord(wallet, recordId);
596
- const json = result.toJSON();
597
- if (!json) return null;
598
- return json;
651
+ if (result.isEmpty) return null;
652
+ return result.toJSON();
599
653
  }
600
654
  async function getWalletTargetingProfile(api, wallet) {
601
655
  const result = await api.rpc.awarizon.getWalletTargetingProfile(wallet);
@@ -664,8 +718,8 @@ async function getVestingSchedule(api, account) {
664
718
  }
665
719
  async function getIdentity(api, account) {
666
720
  const result = await api.rpc.awarizon.getIdentity(account, null);
721
+ if (result.isEmpty) return null;
667
722
  const json = result.toJSON();
668
- if (!json) return null;
669
723
  return {
670
724
  account: json.account,
671
725
  rizName: json.riz_name ?? null,
@@ -687,8 +741,8 @@ async function getIdentity(api, account) {
687
741
  }
688
742
  async function lookupName(api, name) {
689
743
  const result = await api.rpc.awarizon.lookupName(name, null);
744
+ if (result.isEmpty) return null;
690
745
  const json = result.toJSON();
691
- if (!json) return null;
692
746
  const identity = json.identity ? await getIdentity(api, json.account) : null;
693
747
  return {
694
748
  rizName: json.riz_name,
@@ -715,6 +769,32 @@ async function getTotalIdentities(api) {
715
769
  const result = await api.rpc.awarizon.getTotalIdentities(null);
716
770
  return result.toNumber();
717
771
  }
772
+ async function getDexPool(api, assetA, assetB) {
773
+ const result = await api.rpc.dex.getPool(assetA, assetB);
774
+ if (result.isEmpty) return null;
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
+ if (result.isEmpty) return null;
784
+ return result.toJSON();
785
+ }
786
+ async function getAllDexPools(api, limit = 50) {
787
+ const result = await api.rpc.dex.getAllPools(limit);
788
+ return result.toJSON() ?? [];
789
+ }
790
+ async function getDexFeeDestination(api) {
791
+ const result = await api.rpc.dex.getFeeDestination();
792
+ return result.toString().toLowerCase() === "treasury" ? "treasury" : "burn";
793
+ }
794
+ async function getDexTotalBurned(api) {
795
+ const result = await api.rpc.dex.getTotalBurned();
796
+ return result.toString();
797
+ }
718
798
 
719
799
  // src/extrinsics/developer.ts
720
800
  function buildRegisterDeveloper(api) {
@@ -1227,12 +1307,18 @@ async function signAndSend(api, extrinsic, signer) {
1227
1307
  generateCampaignId,
1228
1308
  getActiveCampaignCount,
1229
1309
  getActiveValidators,
1310
+ getAllDexPools,
1230
1311
  getBlockTransactions,
1231
1312
  getCampaign,
1232
1313
  getCampaignDeliveryStatus,
1233
1314
  getDeveloperCampaigns,
1234
1315
  getDeveloperManifests,
1235
1316
  getDeveloperProfile,
1317
+ getDexFeeDestination,
1318
+ getDexPool,
1319
+ getDexQuote,
1320
+ getDexTotalBurned,
1321
+ getDexTwap,
1236
1322
  getIdentity,
1237
1323
  getInboxCount,
1238
1324
  getInboxRecord,