Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

warmpocket source realm

Package warmpocket implements on-chain gift envelopes and recurring care plans.

Overview

Package warmpocket implements on-chain gift envelopes and recurring care plans.

WarmPocket (中文名:暖袋) keeps funds inside the realm until a recipient claims them. Two modes are supported:

  • Instant gift: a single claim, optionally protected by a secret link code.
  • Care plan: monthly / quarterly / yearly installments that the recipient claims when each installment is due; the sender can cancel and reclaim any unclaimed funds at any time.

All money flows are push-only (the sender attaches ugnot to the transaction), and payouts are made from the realm's own balance with BankerTypeRealmSend.

Functions 10

func Cancel

crossing Action
1func Cancel(cur realm, id string) string
source

Cancel refunds all unclaimed funds to the original sender.

func Claim

crossing Action
1func Claim(cur realm, code string) string
source

Claim pays one installment to the caller. For an instant gift the envelope is marked claimed; for a plan the next due date is advanced by its period.

func CreateInstant

crossing Action
1func CreateInstant(cur realm, code, title, theme, recipient string, amount int64) string
source

CreateInstant funds a single-use envelope. A recipient address restricts the claim to one wallet; leaving it empty turns the code into a bearer link.

func CreatePlan

crossing Action
1func CreatePlan(cur realm, code, title, theme, recipient string, amount int64, periodMonths, installments int, startUnix int64) string
source

CreatePlan funds a recurring allowance. Funds are held by the realm and released one installment at a time when the recipient calls Claim.

func GetGift

Action
1func GetGift(id string) string
source

GetGift returns pipe-separated fields: id|kind|sender|recipient|code|title|theme|amount|remaining|period|installments|paid|nextDue|createdAt|claimed|canceled

func Render

1func Render(path string) string
source

Render gives gnoweb a usable, text-only dashboard for the realm.

Types 1

type Gift

struct
 1type Gift struct {
 2	ID           string
 3	Kind         string
 4	Sender       address
 5	Recipient    address
 6	Code         string
 7	Title        string
 8	Theme        string
 9	Amount       int64 // per claim, in ugnot
10	Total        int64 // originally funded amount
11	Remaining    int64 // still held by the realm for this gift
12	PeriodMonths int   // 0 for instant, otherwise 1 / 3 / 12
13	Installments int
14	Paid         int
15	NextDue      int64 // unix seconds
16	CreatedAt    int64
17	Claimed      bool
18	Canceled     bool
19}
source

Gift is the persisted record of one envelope or one recurring plan.

Dependencies

Source Files 2