Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Token Airdrop Transaction #2492

Merged
merged 33 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
674f824
feat: add Airdrop Transaction
ivaylonikolov7 Aug 25, 2024
bd5d5e3
test(wip): unit tests
ivaylonikolov7 Aug 25, 2024
46f8158
fix: use interface for AccountAmount protobuf
ivaylonikolov7 Aug 27, 2024
fb4d428
fix: remove circular dependancy
ivaylonikolov7 Aug 27, 2024
42b74d5
refactor: RenameTokenTransfer list to TokenTransfer
ivaylonikolov7 Aug 27, 2024
d3febec
feat: rename token transfer and add expected decimals
ivaylonikolov7 Aug 27, 2024
ae01f4b
refactor: remove redundant code
ivaylonikolov7 Aug 27, 2024
f68acd2
test: finished unit tests
ivaylonikolov7 Aug 27, 2024
34673c9
fix: correct return type for amount
ivaylonikolov7 Aug 27, 2024
75cf548
fix: correct return for fromProtobuf
ivaylonikolov7 Aug 27, 2024
4c66eec
feat: add missing methods
ivaylonikolov7 Aug 28, 2024
176d7b8
refactor: use already implemented interfaces and classes
ivaylonikolov7 Aug 28, 2024
af7a7df
refactor: transfer transaction and airdrop transaction
ivaylonikolov7 Aug 29, 2024
6de1176
feat: add logid and execute
ivaylonikolov7 Aug 29, 2024
8cd5606
feat: add integration tests
ivaylonikolov7 Aug 29, 2024
f41a54d
feat: add pending airdrop to rectord
ivaylonikolov7 Aug 30, 2024
8b305af
test: add nft transfers to all test cases
ivaylonikolov7 Aug 30, 2024
fd7b686
chore: remove unused files for airdrop
ivaylonikolov7 Aug 30, 2024
43f6175
refactor: remove circular dependancy and unused import
ivaylonikolov7 Aug 30, 2024
778b742
refactor: remove duplicated property
ivaylonikolov7 Aug 30, 2024
ec04f31
refactor: rename pendngairdroprecord
ivaylonikolov7 Sep 2, 2024
dda7ebc
refactor: remove unused files
ivaylonikolov7 Sep 2, 2024
fc6ded6
refactor: rename AirdropTokenTransaction
ivaylonikolov7 Sep 2, 2024
76fe0e1
test: add additional tests
ivaylonikolov7 Sep 2, 2024
e540dd1
fix: rename file reference
ivaylonikolov7 Sep 2, 2024
df64cfc
test: check if newPendingAirdrops is empty for auto associated test
ivaylonikolov7 Sep 2, 2024
72a0838
refactor: remove comment lines
ivaylonikolov7 Sep 4, 2024
e84809d
test: remove get receipt line because we call get record
ivaylonikolov7 Sep 4, 2024
33d4a66
test: should be able to airdrop when receiver sig set to true
ivaylonikolov7 Sep 4, 2024
394ace8
refactor: rename AbstractTokenTransfer
ivaylonikolov7 Sep 9, 2024
f592ba8
feat: Token Claim and Cancel Transaction (#2499)
ivaylonikolov7 Sep 11, 2024
f6f5928
fix(test): when empty id should be null
ivaylonikolov7 Sep 11, 2024
0e6079f
refactor: should return always in jsdoc
ivaylonikolov7 Sep 11, 2024
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
419 changes: 419 additions & 0 deletions examples/token-airdrop-example.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/proto/src/proto
47 changes: 47 additions & 0 deletions src/Status.js
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,14 @@ export default class Status {
return "PENDING_NFT_AIRDROP_ALREADY_EXISTS";
case Status.AccountHasPendingAirdrops:
return "ACCOUNT_HAS_PENDING_AIRDROPS";
case Status.ThrottledAtConsensus:
return "THROTTLED_AT_CONSENSUS";
case Status.InvalidPendingAirdropId:
return "INVALID_PENDING_AIRDROP_ID";
case Status.TokenAirdropWithFallbackRoyalty:
return "TOKEN_AIRDROP_WITH_FALLBACK_ROYALTY";
case Status.InvalidTokenInPendingAirdrop:
return "INVALID_TOKEN_IN_PENDING_AIRDROP";
default:
return `UNKNOWN (${this._code})`;
}
Expand Down Expand Up @@ -1349,6 +1357,14 @@ export default class Status {
return Status.PendingNftAirdropAlreadyExists;
case 365:
return Status.AccountHasPendingAirdrops;
case 366:
return Status.ThrottledAtConsensus;
case 367:
return Status.InvalidPendingAirdropId;
case 368:
return Status.TokenAirdropWithFallbackRoyalty;
case 369:
return Status.InvalidTokenInPendingAirdrop;
default:
throw new Error(
`(BUG) Status.fromCode() does not handle code: ${code}`,
Expand Down Expand Up @@ -3030,3 +3046,34 @@ Status.PendingNftAirdropAlreadyExists = new Status(364);
* this transaction.
*/
Status.AccountHasPendingAirdrops = new Status(365);

/**
* Consensus throttle did not allow execution of this transaction.<br/>
* The transaction should be retried after a modest delay.
*/
Status.ThrottledAtConsensus = new Status(366);

/**
* The provided pending airdrop id is invalid.<br/>
* This pending airdrop MAY already be claimed or cancelled.
* <p>
* The client SHOULD query a mirror node to determine the current status of
* the pending airdrop.
*/
Status.InvalidPendingAirdropId = new Status(367);

/**
* The token to be airdropped has a fallback royalty fee and cannot be
* sent or claimed via an airdrop transaction.
*/
Status.TokenAirdropWithFallbackRoyalty = new Status(368);

/**
* This airdrop claim is for a pending airdrop with an invalid token.<br/>
* The token might be deleted, or the sender may not have enough tokens
* to fulfill the offer.
* <p>
* The client SHOULD query mirror node to determine the status of the pending
* airdrop and whether the sender can fulfill the offer.
*/
Status.InvalidTokenInPendingAirdrop = new Status(369);
Loading