Skip to content

Commit

Permalink
fix(types): add Buy-Name to supported intent types
Browse files Browse the repository at this point in the history
  • Loading branch information
dtfiedler committed Jan 7, 2025
1 parent 9f892f9 commit b5a6d01
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
9 changes: 7 additions & 2 deletions src/types/io.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,13 +336,18 @@ export type AoRedelegateStakeParams = {
};

export const validIntents = [
'Buy-Record',
'Buy-Name',
'Buy-Record', // for backwards compatibility
'Extend-Lease',
'Increase-Undername-Limit',
'Upgrade-Name',
'Primary-Name-Request',
] as const;
export const intentsUsingYears = ['Buy-Record', 'Extend-Lease'] as const;
export const intentsUsingYears = [
'Buy-Record', // for backwards compatibility
'Buy-Name',
'Extend-Lease',
] as const;
export type Intent = (typeof validIntents)[number];
export const isValidIntent = (intent: string): intent is Intent => {
return validIntents.indexOf(intent as Intent) !== -1;
Expand Down
16 changes: 13 additions & 3 deletions tests/e2e/esm/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,15 +433,25 @@ describe('e2e esm tests', async () => {
}
});

it('should be able to get token cost for leasing a name', async () => {
it('should be able to get token cost for leasing a name using `Buy-Record` intent', async () => {
const tokenCost = await ario.getTokenCost({
intent: 'Buy-Record',
intent: 'Buy-Name',
name: 'new-name',
years: 1,
});
assert.ok(tokenCost);
});
it('should be able to get token cost for buying a name name', async () => {

it('should be able to get token cost for buying a name using `Buy-Name` intent', async () => {
const tokenCost = await ario.getTokenCost({
intent: 'Buy-Record',
name: 'new-name',
type: 'permabuy',
});
assert.ok(tokenCost);
});

it('should be able to get token cost for buying a name using `Buy-Record` intent', async () => {
const tokenCost = await ario.getTokenCost({
intent: 'Buy-Record',
name: 'new-name',
Expand Down

0 comments on commit b5a6d01

Please sign in to comment.