Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
dist/
5 changes: 1 addition & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@
"unused-imports"
],
"rules": {
"indent": [
"error",
2
],
"indent": "off", // prettier takes care of this (yarn format)
"quotes": ["error", "single", { "avoidEscape": true, "allowTemplateLiterals": true }],
"quote-props": ["error", "as-needed"],
"semi": ["error", "always"],
Expand Down
2 changes: 1 addition & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"singleQuote": false
"singleQuote": true
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"build": "lerna run build --stream",
"test": "lerna run test --stream",
"lint": "lerna run lint --parallel",
"format": "lerna run format --parallel",
"symlink": "symlink-workspace --logLevel error",
"postinstall": "yarn symlink"
},
Expand All @@ -22,15 +23,15 @@
"@typescript-eslint/parser": "^7.10.0",
"copyfiles": "^2.4.1",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-prettier": "^10.1.5",
"eslint-plugin-simple-import-sort": "^12.1.0",
"eslint-plugin-unused-imports": "^4.0.0",
"glob": "8.0.3",
"jest": "^29.6.2",
"jest-in-case": "^1.0.2",
"lerna": "^6",
"mkdirp": "1.0.2",
"prettier": "^3.0.2",
"prettier": "^3.6.0",
"rimraf": "4.4.1",
"strip-ansi": "^6",
"symlink-workspace": "^1.9.0",
Expand Down
1 change: 1 addition & 0 deletions packages/ast/.eslintignore
66 changes: 33 additions & 33 deletions packages/ast/__tests__/babel/babel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
classDeclaration,
classProperty,
promiseTypeAnnotation,
typedIdentifier
typedIdentifier,
} from '../../src/utils/babel';
import { expectCode } from '../../test-utils';

Expand Down Expand Up @@ -54,12 +54,12 @@ it('interfaces', async () => {
'limit',
t.tsTypeAnnotation(t.tsStringKeyword()),
true
)
),
],
promiseTypeAnnotation('TokensResponse')
)
)
)
),
])
)
),
Expand All @@ -73,7 +73,7 @@ it('interfaces', async () => {
[
t.tSExpressionWithTypeArguments(
t.identifier('SG721ReadOnlyInstance')
)
),
],
t.tSInterfaceBody([
// contract address
Expand Down Expand Up @@ -101,15 +101,15 @@ it('interfaces', async () => {
typedIdentifier(
'prop3',
t.tsTypeAnnotation(t.tsStringKeyword())
)
),
],
promiseTypeAnnotation('ExecuteResult')
)
)
)
),
])
)
)
),
])
);
});
Expand Down Expand Up @@ -149,7 +149,7 @@ it('readonly classes', async () => {
typedIdentifier(
'contractAddress',
t.tsTypeAnnotation(t.tsStringKeyword())
)
),
],
t.blockStatement([
// client/contract set
Expand Down Expand Up @@ -178,7 +178,7 @@ it('readonly classes', async () => {
bindMethod('approval'),
bindMethod('otherProp'),
bindMethod('hello'),
bindMethod('mintme')
bindMethod('mintme'),
])
),

Expand All @@ -196,7 +196,7 @@ it('readonly classes', async () => {
typedIdentifier(
'spender',
t.tsTypeAnnotation(t.tsStringKeyword())
)
),
],
t.blockStatement([
t.returnStatement(
Expand Down Expand Up @@ -227,31 +227,31 @@ it('readonly classes', async () => {
t.identifier('spender'),
false,
true
)
])
),
]),
]
)
)
),
]),
t.tsTypeAnnotation(
t.tsTypeReference(
t.identifier('Promise'),
t.tsTypeParameterInstantiation([
t.tSTypeReference(t.identifier('ApprovalResponse'))
t.tSTypeReference(t.identifier('ApprovalResponse')),
])
)
),
true
)
)
),
],
[
t.tSExpressionWithTypeArguments(
t.identifier('SG721ReadOnlyInstance')
)
),
]
)
)
),
])
);
});
Expand Down Expand Up @@ -291,14 +291,14 @@ it('mutation classes', async () => {
typedIdentifier(
'contractAddress',
t.tsTypeAnnotation(t.tsStringKeyword())
)
),
],
t.blockStatement([
// super()
t.expressionStatement(
t.callExpression(t.super(), [
t.identifier('client'),
t.identifier('contractAddress')
t.identifier('contractAddress'),
])
),

Expand Down Expand Up @@ -328,7 +328,7 @@ it('mutation classes', async () => {
bindMethod('approval'),
bindMethod('otherProp'),
bindMethod('hello'),
bindMethod('mintme')
bindMethod('mintme'),
])
),

Expand All @@ -353,7 +353,7 @@ it('mutation classes', async () => {
typedIdentifier(
'token_uri',
t.tsTypeAnnotation(t.tsStringKeyword())
)
),
],
t.blockStatement([
t.returnStatement(
Expand Down Expand Up @@ -391,37 +391,37 @@ it('mutation classes', async () => {
t.objectProperty(
t.identifier('expression'),
t.objectExpression([])
)
),
])
)
),
]),
t.stringLiteral('auto')
t.stringLiteral('auto'),
]
)
)
)
),
]),
// return type
t.tsTypeAnnotation(
t.tsTypeReference(
t.identifier('Promise'),
t.tsTypeParameterInstantiation([
t.tSTypeReference(t.identifier('ExecuteResult'))
t.tSTypeReference(t.identifier('ExecuteResult')),
])
)
),
true
)
)
),
],
[
t.tSExpressionWithTypeArguments(
t.identifier('SG721ReadOnlyInstance')
)
),
],
t.identifier('SG721QueryClient')
)
)
),
])
);
});
Expand All @@ -439,7 +439,7 @@ it('object parms', () => {
t.identifier('tokenId'),
false,
true
)
),
]);
obj.typeAnnotation = t.tsTypeAnnotation(
t.tsTypeLiteral([
Expand All @@ -450,7 +450,7 @@ it('object parms', () => {
t.tsPropertySignature(
t.identifier('tokenId'),
t.tsTypeAnnotation(t.tsStringKeyword())
)
),
])
);
expectCode(
Expand All @@ -471,13 +471,13 @@ it('object parms', () => {
t.tsTypeReference(
t.identifier('Promise'),
t.tsTypeParameterInstantiation([
t.tsTypeReference(t.identifier('OwnerOfResponse'))
t.tsTypeReference(t.identifier('OwnerOfResponse')),
])
)
)
)
)
)
),
])
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
createExecuteClass,
createExecuteInterface,
createQueryClass,
createTypeInterface
createTypeInterface,
} from '../../src';
import { expectCode, makeContext } from '../../test-utils';

Expand Down
40 changes: 17 additions & 23 deletions packages/ast/__tests__/client/ts-client.arrays-item-tuples.test.ts
Original file line number Diff line number Diff line change
@@ -1,40 +1,34 @@
import {
createExecuteClass,
createExecuteInterface,
createQueryClass} from '../../src';
import { expectCode, getMsgExecuteLegacyFixture, getMsgQueryLegacyFixture, makeContext } from '../../test-utils';
createQueryClass,
} from '../../src';
import {
expectCode,
getMsgExecuteLegacyFixture,
getMsgQueryLegacyFixture,
makeContext,
} from '../../test-utils';
const queryMsg = getMsgQueryLegacyFixture('misc/schema', '/arrays.json');
const execMsg = getMsgExecuteLegacyFixture('misc/schema', '/arrays.json');
const ctx = makeContext(queryMsg, {
types: {
itemsUseTuples: true
}
itemsUseTuples: true,
},
});

it('query classes', () => {
expectCode(createQueryClass(
ctx,
'SG721QueryClient',
'SG721ReadOnlyInstance',
queryMsg
));
expectCode(
createQueryClass(ctx, 'SG721QueryClient', 'SG721ReadOnlyInstance', queryMsg)
);
});

it('execute classes array types', () => {
expectCode(createExecuteClass(
ctx,
'SG721Client',
'SG721Instance',
null,
execMsg
));
expectCode(
createExecuteClass(ctx, 'SG721Client', 'SG721Instance', null, execMsg)
);
});

it('execute interfaces no extends', () => {
expectCode(createExecuteInterface(
ctx,
'SG721Instance',
null,
execMsg
));
expectCode(createExecuteInterface(ctx, 'SG721Instance', null, execMsg));
});
Loading