Skip to content

Commit

Permalink
fix solana donation tests and logic
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosQ96 committed Dec 19, 2023
1 parent bcee977 commit 7aab9a3
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion migration/data/seedTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,7 @@ const seedTokens: ITokenData[] = [
symbol: 'SOL',
address: '0x0000000000000000000000000000000000000000',
decimals: 18,
networkId: 1399811149,
networkId: 0,
chainType: ChainType.SOLANA,
},
];
Expand Down
2 changes: 1 addition & 1 deletion src/entities/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class Token extends BaseEntity {
@Column()
networkId: number;

@Field()
@Field(type => String)
@Column({
type: 'enum',
enum: ChainType,
Expand Down
4 changes: 2 additions & 2 deletions src/resolvers/donationResolver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -796,8 +796,8 @@ function createDonationTestCases() {
id: saveDonationResponse.data.data.createDonation,
},
});
assert.equal(donation!.transactionId, transactionId);
assert.equal(donation!.chainType, ChainType.SOLANA);
assert.equal(donation?.transactionId, transactionId.toLowerCase());
assert.equal(donation?.chainType, ChainType.SOLANA);
});

it('should create a donation in an active qfRound when qfround has network eligiblity on XDAI', async () => {
Expand Down
1 change: 1 addition & 0 deletions src/resolvers/donationResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,7 @@ export class DonationResolver {
fromWalletAddress: fromAddress.toString().toLowerCase(),
anonymous: Boolean(anonymous),
safeTransactionId,
chainType: chainType as ChainType,
});
if (referrerId) {
// Fill referrer data if referrerId is valid
Expand Down
2 changes: 1 addition & 1 deletion src/utils/validators/graphqlQueryValidators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const resourcePerDateRegex = new RegExp(

const ethereumWalletAddressRegex = /^0x[a-fA-F0-9]{40}$/;
const txHashRegex = /^0x[a-fA-F0-9]{64}$/;
const solanaTxRegex = /^.*$/; // TODO find the correct transaction ID and validation
const solanaTxRegex = /^[A-Za-z0-9]{88}$/; // TODO find the correct transaction ID and validation
const tokenSymbolRegex = /^[a-zA-Z0-9]{2,10}$/; // OPTIMISTIC OP token is 2 chars long

export const validateWithJoiSchema = (data: any, schema: ObjectSchema) => {
Expand Down
2 changes: 1 addition & 1 deletion test/pre-test-scripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ async function seedTokens() {
for (const token of SEED_DATA.TOKENS.solana) {
const tokenData = {
...token,
networkId: 1399811149,
networkId: 0,
isGivbackEligible: false,
chainType: ChainType.SOLANA,
};
Expand Down

0 comments on commit 7aab9a3

Please sign in to comment.